]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/nolibc: Add _NOLIBC_OPTIMIZER_HIDE_VAR() to compiler.h
authorDavid Laight <david.laight.linux@gmail.com>
Sun, 8 Mar 2026 11:37:26 +0000 (11:37 +0000)
committerThomas Weißschuh <linux@weissschuh.net>
Fri, 20 Mar 2026 16:46:06 +0000 (17:46 +0100)
Needed to stop compiler 'optimisations' bloating code.
Equivalent to the definition in include/linux/compiler.h

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-2-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/compiler.h

index a8c7619dcdde2f08dcd4a0daef3e6e4a413e27d7..f03f84cfadce24346698e5088fda427aa5f1d825 100644 (file)
@@ -71,4 +71,7 @@
 #  define __nolibc_static_assert(_t)
 #endif
 
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
+#define _NOLIBC_OPTIMIZER_HIDE_VAR(var)        __asm__ ("" : "+r" (var))
+
 #endif /* _NOLIBC_COMPILER_H */