summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2025-04-19 13:46:18 +0300
committerThomas Weißschuh <linux@weissschuh.net>2025-04-19 15:17:46 +0300
commit8399f14666688be8d84cb3ccbec6ee790c020b36 (patch)
tree3964b79b76cf942b0ad5efe2f233ee1537e4e409
parent60ccc16f530a480abfde399bf80779e5b021b3fe (diff)
downloadlinux-8399f14666688be8d84cb3ccbec6ee790c020b36.tar.xz
tools/nolibc: add __nolibc_has_feature()
Certain compiler features are signaled via the __has_feature() preprocessor builtin. Add a nolibc wrapper for it, similar to __nolibc_has_attribute(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250419-nolibc-ubsan-v2-1-060b8a016917@weissschuh.net
-rw-r--r--tools/include/nolibc/compiler.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
index fa1f547e7f13..e6d6dc116e43 100644
--- a/tools/include/nolibc/compiler.h
+++ b/tools/include/nolibc/compiler.h
@@ -12,6 +12,12 @@
# define __nolibc_has_attribute(attr) 0
#endif
+#if defined(__has_feature)
+# define __nolibc_has_feature(feature) __has_feature(feature)
+#else
+# define __nolibc_has_feature(feature) 0
+#endif
+
#if __nolibc_has_attribute(naked)
# define __nolibc_entrypoint __attribute__((naked))
# define __nolibc_entrypoint_epilogue()