diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2026-04-09 00:03:56 +0300 |
|---|---|---|
| committer | Thomas Weißschuh <linux@weissschuh.net> | 2026-04-10 00:25:35 +0300 |
| commit | 08ab9580726edcc12019d2097b56b88de1142ca7 (patch) | |
| tree | 6e3dc93e326a723b24bb270df271233927c01684 /tools | |
| parent | 598b670af347bc8d998866b1e795e40a3bb168de (diff) | |
| download | linux-08ab9580726edcc12019d2097b56b88de1142ca7.tar.xz | |
tools/nolibc: create __nolibc_no_sanitize_ubsan
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
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/include/nolibc/compiler.h | 6 | ||||
| -rw-r--r-- | tools/include/nolibc/crt.h | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h index 1c410a62c528..b1239344d894 100644 --- a/tools/include/nolibc/compiler.h +++ b/tools/include/nolibc/compiler.h @@ -80,4 +80,10 @@ /* 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 */ diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h index 5bb492555f13..d8ce91fd2e3b 100644 --- a/tools/include/nolibc/crt.h +++ b/tools/include/nolibc/crt.h @@ -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; |
