]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/nolibc: avoid call to wcslen() in _start_c() inserted by clang
authorThomas Weißschuh <linux@weissschuh.net>
Sat, 18 Apr 2026 10:31:54 +0000 (12:31 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Mon, 27 Apr 2026 16:13:27 +0000 (18:13 +0200)
Clang may convert the loop to find _auxv into a call to wcslen() which
is missing on nolibc. -fsanitize needs to be disabled for this to
happen.

Use the same pattern as in the nolibc strlen() implementation to avoid
the function call generation.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260418-nolibc-wcslen-v1-1-671271b8ea63@weissschuh.net
tools/include/nolibc/crt.h

index d8ce91fd2e3b16a0082c5c0a90d36456b87a125a..f38590a05adf0b0b1299498c75d17cd4ceee2d05 100644 (file)
@@ -89,7 +89,7 @@ void _start_c(long *sp)
 
        /* find _auxv */
        for (auxv = (void *)envp; *auxv++;)
-               ;
+               __asm__("");
        _auxv = auxv;
 
 #ifndef NOLIBC_IGNORE_ERRNO