diff --git a/Makefile b/Makefile index 8e982cefd..7ddddce7a 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,8 @@ BUILD_DIR ?= test/build # Skip includes for clean target ifneq ($(MAKECMDGOALS),clean) -include test/mk/config.mk include test/mk/compiler.mk +include test/mk/config.mk include test/mk/auto.mk include test/mk/components.mk include test/mk/rules.mk @@ -266,6 +266,9 @@ else @echo "=== Architecture Not Supported ===" @echo "No specific feature detection available for $(ARCH)" endif + @echo "" + @echo "=== Linker Feature Support ===" + @echo "Fatal Warnings: $(if $(filter 1,$(MK_LINKER_SUPPORTS_FATAL_WARNINGS)),✅,❌)" EXAMPLE_DIRS := \ examples/bring_your_own_fips202 \ diff --git a/test/mk/compiler.mk b/test/mk/compiler.mk index 11d7fe142..829084bfe 100644 --- a/test/mk/compiler.mk +++ b/test/mk/compiler.mk @@ -72,4 +72,9 @@ MK_COMPILER_SUPPORTS_SHA3 ?= $(shell echo 'int main() { __asm__("eor3 v0.16b, v1 endif # aarch64 +# Linker feature detection + +# Test --fatal-warnings support +MK_LINKER_SUPPORTS_FATAL_WARNINGS ?= $(shell echo 'int main() { return 0; }' | $(CC) -x c - -o /dev/null -Wl,--fatal-warnings 2>/dev/null && echo 1 || echo 0) + endif # _COMPILER_MK diff --git a/test/mk/config.mk b/test/mk/config.mk index 5a0f366f1..0f866258b 100644 --- a/test/mk/config.mk +++ b/test/mk/config.mk @@ -53,6 +53,11 @@ CFLAGS := \ -MMD \ $(CFLAGS) +# Treat linker warnings as errors +ifeq ($(MK_LINKER_SUPPORTS_FATAL_WARNINGS),1) +LDFLAGS += -Wl,--fatal-warnings +endif + ################## # Some Variables # ##################