Skip to content

Instantly share code, notes, and snippets.

@mu-mu-mu
Created February 21, 2021 16:16
Show Gist options
  • Save mu-mu-mu/3df4a55871d849631ef41504527d0add to your computer and use it in GitHub Desktop.
Save mu-mu-mu/3df4a55871d849631ef41504527d0add to your computer and use it in GitHub Desktop.
Linux __attribute__ ranking
# Rough Count
# grep --include='*.c' --include='*.h' -r -oP '__attribute__\s*\(\(.+\)\)' ./linux | awk -F'__attribute__\\s*' '{print $2}' | sed 's/^((//' | sed 's/))$//' | sort | uniq -c | sort -nr > res.txt
1817 packed
362 __packed__
199 unused
137 packed, aligned(4)
97 aligned(8)
73 always_inline
71 aligned(32)
66 noinline
56 packed, aligned (4)
47 weak
43 preserve_access_index
35 noreturn
28 aligned(16)
24 const
17 used
17 aligned(256)
17 __aligned__(8)
15 aligned(64)
14 constructor
14 __unused__
13 packed,aligned(4)
13 aligned(4)
12 aligned(128)
11 aligned (8)
10 unused)
10 packed, aligned(8)
10 format (printf, 1, 2)
9 aligned(PAGE_SIZE)
8 format(printf, 2, 3)
7 packed, aligned (8)
7 format (printf, 4, 5)
7 aligned(sizeof(long))
6 visibility("hidden")
6 pure
6 packed,aligned(8)
6 mode (__word__)
6 __aligned__(16)
5 section(NAME), used
5 packed, aligned(2)
5 always_inline)) typeof(name(0
5 aligned (__alignof__(struct ebt_replace))
5 __aligned__(SMP_CACHE_BYTES)
5 __aligned__(AESNI_ALIGN)
4 weak, alias("__vdso_clock_gettime")
4 packed, aligned(256)
4 nonnull
4 mode(SI)
4 mode(DI)
4 format(printf, 1, 2)
4 aligned(sizeof(unsigned long))
4 aligned(__alignof__(u64))
4 aligned (SMP_CACHE_BYTES)
4 aligned (16)
4 __mode__ (__DI__)
4 __may_alias__
4 __aligned__(BITS_PER_LONG/8)
4 aligned(32)
3 weak, alias("__vdso_gettimeofday")
3 visibility("default")
3 regparm(0)
3 nonnull(2,3)
3 mode(TI)
3 format(printf, a, b)
3 destructor
3 bitwise
3 aligned(x)
3 aligned(sizeof(__u64))
3 aligned(a)
3 aligned (sizeof(uint64_t))
3 alias("thermal_genl_event_tz")
3 __noreturn__
3 __flatten__
3 __aligned__(PADLOCK_ALIGNMENT)
2 weak,unused
2 weak, alias("__vdso_time")
2 weak, alias("__vdso_getcpu")
2 weak, alias("__vdso_clock_getres")
2 warn_unused_result, nonnull
2 vector_size(16)
2 user
2 section(".maps." #name), used
2 packed,aligned(2)
2 packed, aligned(PMCRAID_IOARCB_ALIGNMENT)
2 packed, aligned(16)
2 packed, aligned (16)
2 noreturn,unused
2 nonnull(2)
2 no_sanitize_address
2 mode (SI)
2 mode (DI)
2 latent_entropy
2 format(printf, 4, 5)
2 format(printf, 3, 4)
2 format(printf, 1, 2)))
2 force
2 common
2 aligned(sizeof(void *))
2 aligned(sizeof(Elf##size##_Word))
2 aligned(__alignof__(struct nft_expr))
2 aligned(VRING_USED_ALIGN_SIZE)
2 aligned(512)
2 aligned(4 * sizeof(__u64))
2 aligned(32), packed
2 aligned(0x20000)
2 aligned (XCHAL_NCP_SA_ALIGN)
2 aligned (L1_CACHE_BYTES)
2 aligned (64)
2 alias(__stringify(__se_sys##name))
2 alias(__stringify(__se_compat_sys##name))
2 alias("cfi_cmdset_0002")
2 alias("cfi_cmdset_0001")
2 __section__("__builtin_cmdline")
2 __section__ (".__syscall_stub")
2 __model__ (__small__)
2 __mode__ (__SI__)
2 __aligned__(x)
2 __aligned__(sizeof(long))
2 __aligned__(32)
2 __aligned__(128)
1 weakref("dsdt_aml_code")
1 weakref("AmlCode")
1 weak,visibility("hidden")
1 weak, alias("__vdso_clock_gettime64")
1 weak, alias("__platform_"#f)
1 weak, alias("__mips_cm_phys_base")
1 weak, alias("__mips_cm_l2sync_phys_base")
1 weak, alias("__alloc_bootmem_huge_page")
1 visibility ("hidden")
1 vector_size (8)
1 unused, alias(__stringify(name))
1 tls_model("initial-exec"), unused
1 tls_model("initial-exec")
1 syscall_linkage
1 section(PER_CPU_BASE_SECTION sec)
1 section(NAME), used
1 section("license"),used
1 section("action-ok"),used
1 section("action-ko"),used
1 section("___ksymtab" sec "+" #sym), used
1 section(".vvar_" #name), aligned(16)
1 section(".ksyms")
1 section(".kconfig")
1 safe
1 returns_twice
1 require_context(x,1,999,"write")
1 require_context(x,1,999,"read")
1 require_context(x,1,999,"rdwr")
1 randomize_layout
1 patchable_function_entry(0, 0)
1 packed, deprecated
1 packed, aligned(PMCRAID_IOADL_ALIGNMENT)
1 packed, aligned(PAGE_SIZE)
1 packed, aligned(64)
1 packed, aligned(2048)
1 packed, aligned(1024)
1 packed, aligned (XSAVE_ALIGNMENT)
1 packed, aligned (64)
1 noreturn)) __attribute ((format (printf, 1, 2)
1 nonnull(2,3,4,5)
1 nonnull(2,3,4)
1 nonnull(1)
1 noderef, address_space(__user)
1 noderef, address_space(__rcu)
1 noderef, address_space(__percpu)
1 noderef, address_space(__iomem)
1 noderef
1 nocast
1 no_sanitize_undefined
1 no_sanitize_thread
1 no_sanitize("undefined")
1 no_sanitize("thread")
1 no_sanitize("address", "hwaddress")
1 no_randomize_layout
1 no_instrument_function
1 ms_abi
1 mode(TF)
1 mode(QI)
1 mode(HI)
1 malloc
1 long_call
1 hotpatch(0, 0)
1 hot
1 gnu_inline
1 format(scanf, a, b)
1 format(printf,a,b)
1 format(printf,3,4)
1 format(printf, 5, 6)
1 format (printf, i, j)
1 format (printf, 3, 4)
1 format (printf, 2, 3)
1 format (printf, 2, 0)
1 format (printf, (pos_fmtstr), (pos_fmtargs))
1 format (gnu_printf, i, j)
1 fallthrough
1 externally_visible
1 error(message)
1 deprecated(msg)
1 deprecated
1 context(x,1,1)
1 context(x,1,0)
1 context(x,0,1)
1 aligned(stackalign)
1 aligned(sizeof(u32))
1 aligned(sizeof(s64))
1 aligned(sizeof(kernel_ulong_t))
1 aligned(__alignof__(u32))
1 aligned(__alignof__(struct hash_alg_common))
1 aligned(_K_SS_ALIGNSIZE)
1 aligned(VRING_DESC_ALIGN_SIZE)
1 aligned(VRING_AVAIL_ALIGN_SIZE)
1 aligned(TSB_ENTRY_ALIGNMENT)
1 aligned(TPACKET_ALIGNMENT)
1 aligned(TPACKET_ALIGN(x))
1 aligned(SMP_CACHE_BYTES)
1 aligned(SLOTS_ALIGN)
1 aligned(L1_CACHE_BYTES)
1 aligned(DM_IO_MAX_REGIONS)
1 aligned(CVMX_CACHE_LINE_SIZE)
1 aligned(CPPI_DESCRIPTOR_ALIGN)
1 aligned(65536)
1 aligned(4096)
1 aligned(256), packed
1 aligned(2048)
1 aligned(2), packed
1 aligned(2)
1 aligned(2 * sizeof(long))
1 aligned(1024),packed
1 aligned(0x80)
1 aligned(0x2000)
1 aligned((sizeof(long)))
1 aligned (sizeof(void *))
1 aligned (sizeof(unsigned long))
1 aligned (XCHAL_CP7_SA_ALIGN)
1 aligned (XCHAL_CP6_SA_ALIGN)
1 aligned (XCHAL_CP5_SA_ALIGN)
1 aligned (XCHAL_CP4_SA_ALIGN)
1 aligned (XCHAL_CP3_SA_ALIGN)
1 aligned (XCHAL_CP2_SA_ALIGN)
1 aligned (XCHAL_CP1_SA_ALIGN)
1 aligned (XCHAL_CP0_SA_ALIGN)
1 aligned (PS3_BMP_MINALIGN)
1 aligned (4)
1 align_value(8)
1 alias(istringify(SIG_EXPR_LIST_SYM(sig, group)))
1 alias(__stringify(__s390x_sys_##sname))
1 alias(#system "_mv")
1 alias(#internal_name)
1 alias(#initfn)
1 alias(#exitfn)
1 alias("thermal_genl_event_tz_trip_up")
1 alias("thermal_genl_event_tz_trip_add")
1 alias("octeon_board_type_string")
1 alias("native_sched_clock")
1 address_space(0)
1 __weak__
1 __warning__(message)
1 __warn_unused_result__
1 __used__
1 __target__("no-vsx")
1 __section__(section)
1 __section__(#section), aligned((sizeof(void *)))
1 __section__(#__sec ".init")
1 __section__("___kentry+" #sym)
1 __section__(".initcall" level ".init")
1 __pure__
1 __packed__, __aligned__(8)
1 __nonstring__
1 __noinline__
1 __noclone__
1 __no_sanitize__("shadow-call-stack")
1 __no_instrument_function__
1 __no_caller_saved_registers__
1 __name__
1 __naked__
1 __mode__(x)
1 __malloc__
1 __indirect_branch__("keep")
1 __gnu_inline__
1 __format__(scanf, a, b)
1 __format__(printf, a, b)
1 __format__ (__printf__, c, c+1)
1 __fallthrough__
1 __externally_visible__
1 __error__(message)
1 __designated_init__
1 __copy__(symbol)
1 __const__
1 __cold__
1 __cleanup__(kcsan_end_scoped_access)
1 __assume_aligned__(a, ## __VA_ARGS__)
1 __always_inline__
1 __aligned__(sizeof(u64))
1 __aligned__(PAGE_SIZE)
1 __aligned__(INTERNODE_CACHE_BYTES)
1 __aligned__(GRU_CACHE_LINE_BYTES)
1 __aligned__(CRYPTO_MINALIGN)
1 __aligned__(ALIGN_SIZE)
1 __aligned__(65536)
1 __aligned__(4)
1 __aligned__(1 << (INTERNODE_CACHE_SHIFT))
1 __aligned__
1 __alias__(#symbol)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment