summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-06-16 01:15:29 +0200
committerPeter Zijlstra <peterz@infradead.org>2020-06-16 15:35:02 +0200
commit33aea07f30c261eff7ba229f19fd1b161e0fb851 (patch)
tree30051779e2a636e9fa8bf14873ad41bb114e769e
parent8e8bb06d199a5aa7a534aa3b3fc0abbbc11ca438 (diff)
compiler_attributes.h: Support no_sanitize_undefined check with GCC 4
UBSAN is supported since GCC 4.9, which unfortunately did not yet have __has_attribute(). To work around, the __GCC4_has_attribute workaround requires defining which compiler version supports the given attribute. In the case of no_sanitize_undefined, it is the first version that supports UBSAN, which is GCC 4.9. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Link: https://lkml.kernel.org/r/20200615231529.GA119644@google.com
-rw-r--r--include/linux/compiler_attributes.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
index cdf016596659..c8f03d2969df 100644
--- a/include/linux/compiler_attributes.h
+++ b/include/linux/compiler_attributes.h
@@ -40,6 +40,7 @@
# define __GCC4_has_attribute___noclone__ 1
# define __GCC4_has_attribute___nonstring__ 0
# define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8)
+# define __GCC4_has_attribute___no_sanitize_undefined__ (__GNUC_MINOR__ >= 9)
# define __GCC4_has_attribute___fallthrough__ 0
#endif