]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/nolibc: create __nolibc_no_sanitize_ubsan
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 8 Apr 2026 21:03:56 +0000 (23:03 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Thu, 9 Apr 2026 21:25:35 +0000 (23:25 +0200)
The logic to disable UBSAN will become a bit more complicated.
Move it out into compiler.h, so crt.h stays readable.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20260408-nolibc-gcc-15-v1-1-330d0c40f894@weissschuh.net
tools/include/nolibc/compiler.h
tools/include/nolibc/crt.h

index 1c410a62c52892144ae7dc6a1636c28cac158ebe..b1239344d894a6f446d2db5e4f4e0453f30003aa 100644 (file)
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #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")))
+#else
+#  define __nolibc_no_sanitize_undefined
+#endif
+
 #endif /* _NOLIBC_COMPILER_H */
index 5bb492555f13de657d8910b9358589e4a3b71519..d8ce91fd2e3b16a0082c5c0a90d36456b87a125a 100644 (file)
@@ -47,10 +47,7 @@ char *__nolibc_program_invocation_short_name(char *long_name)
 #endif /* NOLIBC_IGNORE_ERRNO */
 
 void _start_c(long *sp);
-__attribute__((weak,used))
-#if __nolibc_has_feature(undefined_behavior_sanitizer)
-       __attribute__((no_sanitize("function")))
-#endif
+__attribute__((weak,used)) __nolibc_no_sanitize_undefined
 void _start_c(long *sp)
 {
        long argc;