summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Laight <david.laight.linux@gmail.com>2026-03-08 11:37:26 +0000
committerThomas Weißschuh <linux@weissschuh.net>2026-03-20 17:46:06 +0100
commit6702425cd50ebb9a71d6b441df4b0df4f58d160a (patch)
tree138ade8dbc6bde1f1540d8cdc035db095b820d4f
parentcf3470882435c82742ab869d4e2d414de55e7e59 (diff)
tools/nolibc: Add _NOLIBC_OPTIMIZER_HIDE_VAR() to compiler.h
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>
-rw-r--r--tools/include/nolibc/compiler.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
index a8c7619dcdde..f03f84cfadce 100644
--- a/tools/include/nolibc/compiler.h
+++ b/tools/include/nolibc/compiler.h
@@ -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 */