[PATCH] elf: build the IFUNC resolver stack protector tests only with ssp
Matt Turner
mattst88@gmail.com
Mon Aug 10 19:09:09 GMT 2026
The three resolver translation units are compiled with
-fstack-protector-all so that the canary code is emitted whatever the
default is. A target whose compiler has no stack protector at all cannot
do that, and on alpha the build stopped:
cc1: error: '-fstack-protector' not supported for this target [-Werror]
taking the rest of the elf tests with it. Guard the tests on $(have-ssp),
which configure already sets from the compiler's own answer. That is the
answer for -fstack-protector rather than for -fstack-protector-all, which
has its own configure test, but only the former reaches config.make, and a
compiler that has one has the other.
---
elf/Makefile | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git ./elf/Makefile ./elf/Makefile
index 94c5b7e6ed..74a4f0ebfc 100644
--- ./elf/Makefile
+++ ./elf/Makefile
@@ -292,7 +292,7 @@ tests-static-internal := \
tst-tunables-enable_secure \
# tests-static-internal
-ifeq (yes,$(have-gcc-ifunc))
+ifeq (yesyes,$(have-gcc-ifunc)$(have-ssp))
tests-static-internal += \
tst-ifunc-resolver-protector-static \
tst-ifunc-resolver-protector-static-non-pie \
@@ -777,7 +777,7 @@ test-extras += \
tst-tlsmod18a \
# test-extras
-ifeq (yes,$(have-gcc-ifunc))
+ifeq (yesyes,$(have-gcc-ifunc)$(have-ssp))
# The resolver helper needs <tls.h> for the TCB-canary STACK_CHK_GUARD
# macro, so it must be compiled with MODULE_NAME=testsuite_internal.
extra-test-objs += \
@@ -1318,7 +1318,6 @@ tests += \
tst-ifunc-plt-bindnow \
tst-ifunc-plt-dlopen \
tst-ifunc-plt-dlopen-bindnow \
- tst-ifunc-resolver-protector \
tst-ifunc-tls-init \
tst-ifunc-tls-init-gd-ld \
tst-ifunc-tls-write \
@@ -1387,7 +1386,6 @@ modules-names += \
ifuncmod6 \
tst-ifunc-plt-dep \
tst-ifunc-plt-lib \
- tst-ifunc-resolver-protector-mod \
tst-ifunc-tls-init-gd-global-lib \
tst-ifunc-tls-init-gd-lib \
tst-ifunc-tls-init-ld-lib \
@@ -1405,6 +1403,10 @@ endif
ifeq (no,$(with-lld))
modules-names += ifuncmod5
endif
+ifeq ($(have-ssp),yes)
+tests += tst-ifunc-resolver-protector
+modules-names += tst-ifunc-resolver-protector-mod
+endif
endif
endif
--
2.54.0
More information about the Libc-alpha
mailing list