diff -drupN a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h --- a/include/linux/compiler-clang.h 2018-08-06 17:23:04.000000000 +0300 +++ b/include/linux/compiler-clang.h 2022-06-12 05:28:14.000000000 +0300 @@ -20,3 +20,20 @@ #ifdef __noretpoline #undef __noretpoline #endif + +#ifdef CONFIG_LTO_CLANG +#ifdef CONFIG_FTRACE_MCOUNT_RECORD +#define __norecordmcount \ + __attribute__((__section__(".text..ftrace"))) +#endif + +#define __nocfi __attribute__((no_sanitize("cfi"))) +#endif + +/* all clang versions usable with the kernel support KASAN ABI version 5 */ +#define KASAN_ABI_VERSION 5 + +/* emulate gcc's __SANITIZE_ADDRESS__ flag */ +#if __has_feature(address_sanitizer) +#define __SANITIZE_ADDRESS__ +#endif