]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: build the IFUNC resolver stack protector tests only with ssp
authorMatt Turner <mattst88@gmail.com>
Mon, 10 Aug 2026 19:09:09 +0000 (15:09 -0400)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 12 Aug 2026 18:08:02 +0000 (15:08 -0300)
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.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
elf/Makefile

index d279a5135c2b237b1d1b8a6916bdc5cfeda27308..dbc6cfec7fea83c458b8578942b120ce53704ed1 100644 (file)
@@ -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 \
@@ -1412,6 +1410,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