diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 6d7ead22c1b4..02cb5761fef4 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -326,13 +326,19 @@ #define KASAN_ABI_VERSION 3 #endif -#if GCC_VERSION >= 40902 /* - * Tell the compiler that address safety instrumentation (KASAN) - * should not be applied to that function. - * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 + * Older GCCs (< 5) don't support __has_attribute, so instead of checking + * __has_attribute(__no_sanitize_address__) do a GCC version check. */ +#ifndef __has_attribute +# define __has_attribute(x) __GCC4_has_attribute_##x +# define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) +#endif + +#if __has_attribute(__no_sanitize_address__) #define __no_sanitize_address __attribute__((no_sanitize_address)) +#else +#define __no_sanitize_address #endif #if GCC_VERSION >= 50100 |