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
This commit is contained in:
Thomas Weißschuh 2025-04-19 12:46:18 +02:00
parent 60ccc16f53
commit 8399f14666

View File

@ -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()