Skip to content

Commit aa34642

Browse files
committed
tools headers: Sync linux/cfi_types.h with the kernel source
To pick up the changes in this cset: 5ccaeed cfi: add C CFI type macro This addresses these perf build warnings: Warning: Kernel ABI header differences: diff -u tools/include/linux/cfi_types.h include/linux/cfi_types.h Please see tools/include/uapi/README for further details. Cc: Mark Rutland <[email protected]> Signed-off-by: Namhyung Kim <[email protected]>
1 parent 6cb8607 commit aa34642

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tools/include/linux/cfi_types.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,28 @@
4141
SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
4242
#endif
4343

44+
#else /* __ASSEMBLY__ */
45+
46+
#ifdef CONFIG_CFI_CLANG
47+
#define DEFINE_CFI_TYPE(name, func) \
48+
/* \
49+
* Force a reference to the function so the compiler generates \
50+
* __kcfi_typeid_<func>. \
51+
*/ \
52+
__ADDRESSABLE(func); \
53+
/* u32 name __ro_after_init = __kcfi_typeid_<func> */ \
54+
extern u32 name; \
55+
asm ( \
56+
" .pushsection .data..ro_after_init,\"aw\",\%progbits \n" \
57+
" .type " #name ",\%object \n" \
58+
" .globl " #name " \n" \
59+
" .p2align 2, 0x0 \n" \
60+
#name ": \n" \
61+
" .4byte __kcfi_typeid_" #func " \n" \
62+
" .size " #name ", 4 \n" \
63+
" .popsection \n" \
64+
);
65+
#endif
66+
4467
#endif /* __ASSEMBLY__ */
4568
#endif /* _LINUX_CFI_TYPES_H */

0 commit comments

Comments
 (0)