aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/include/nolibc
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-04-24 13:48:11 +0200
committerThomas Weißschuh <linux@weissschuh.net>2025-05-21 15:31:49 +0200
commita6a054c8ad32b04c2e5d3cc5592fa737a2bb771f (patch)
treec4967327d11596ecca82890c5592c03f32869b21 /tools/include/nolibc
parenttools/nolibc: implement width padding in printf() (diff)
downloadwireguard-linux-a6a054c8ad32b04c2e5d3cc5592fa737a2bb771f.tar.xz
wireguard-linux-a6a054c8ad32b04c2e5d3cc5592fa737a2bb771f.zip
tools/nolibc: add target to check header usability
Each nolibc header should be valid for inclusion irrespective of any special ordering requirements. Add a new make target, based on the old kbuild "make header_check" target to validate this requirement. For now the check fails, but the following commits will fix the issues. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-1-011576b6ed6f@linutronix.de
Diffstat (limited to 'tools/include/nolibc')
-rw-r--r--tools/include/nolibc/Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index e05862cd0805..aa2c81d78ead 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -101,5 +101,14 @@ headers_standalone: headers
$(Q)$(MAKE) -C $(srctree) headers
$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
+# GCC uses "s390", clang "systemz"
+CLANG_CROSS_FLAGS := $(subst --target=s390-linux,--target=systemz-linux,$(CLANG_CROSS_FLAGS))
+
+headers_check: headers_standalone
+ for header in $(filter-out crt.h std.h,$(all_files)); do \
+ $(CC) $(CLANG_CROSS_FLAGS) -Wall -Werror -nostdinc -fsyntax-only -x c /dev/null \
+ -I$(or $(objtree),$(srctree))/usr/include -include $$header -include $$header || exit 1; \
+ done
+
clean:
$(call QUIET_CLEAN, nolibc) rm -rf "$(OUTPUT)sysroot"