summaryrefslogtreecommitdiff
path: root/tools/include/nolibc
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-04-08 23:03:57 +0200
committerThomas Weißschuh <linux@weissschuh.net>2026-04-09 23:25:40 +0200
commit3495279d05d62b07d7594c75d4380f51d04410dd (patch)
tree39721755931a8d4c1c74020b1372d4dcacebdd58 /tools/include/nolibc
parent08ab9580726edcc12019d2097b56b88de1142ca7 (diff)
downloadlwn-3495279d05d62b07d7594c75d4380f51d04410dd.tar.gz
lwn-3495279d05d62b07d7594c75d4380f51d04410dd.zip
tools/nolibc: support UBSAN on gcc
The UBSAN implementation in gcc requires a slightly different function attribute to skip instrumentation. Extend __nolibc_no_sanitize_undefined to also handle gcc. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20260408-nolibc-gcc-15-v1-2-330d0c40f894@weissschuh.net
Diffstat (limited to 'tools/include/nolibc')
-rw-r--r--tools/include/nolibc/compiler.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
index b1239344d894..b56570bf9f69 100644
--- a/tools/include/nolibc/compiler.h
+++ b/tools/include/nolibc/compiler.h
@@ -81,7 +81,11 @@
#define _NOLIBC_OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "+r" (var))
#if __nolibc_has_feature(undefined_behavior_sanitizer)
-# define __nolibc_no_sanitize_undefined __attribute__((no_sanitize("function")))
+# if defined(__clang__)
+# define __nolibc_no_sanitize_undefined __attribute__((no_sanitize("function")))
+# else
+# define __nolibc_no_sanitize_undefined __attribute__((no_sanitize_undefined))
+# endif
#else
# define __nolibc_no_sanitize_undefined
#endif