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
This commit is contained in:
Thomas Weißschuh 2026-04-08 23:03:56 +02:00
parent 598b670af3
commit 08ab958072
2 changed files with 7 additions and 4 deletions

View File

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

View 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;