Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9083aa8 authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Alistair Delva
Browse files

ANDROID: kasan: fix has_attribute check on older GCC versions



A previously backported commit 8712cc72 ("BACKPORT: kasan: add
CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS") introduced a
__has_attribute(__no_sanitize_address__) check into
include/linux/compiler-gcc.h. Unfortunately older GCCs (before version 5)
don't support support this macro, which results in a compilation error.

Fix by checking GCC version instead. The same fix was applied to the 4.14
common kernel during the backport, but was forgotten here.

Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Bug: 128674696
Bug: 142406440
Change-Id: I79cbc3fdc568c0d4905d296b8e5f979da5b41bbb
parent 8ea67644
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -183,6 +183,15 @@
#define KASAN_ABI_VERSION 3
#endif

/*
 * 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