[glibc] elf: build the IFUNC resolver stack protector tests only with ssp

Adhemerval Zanella via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e6f3cc4246a86279ca963b589b8dc9dd15714cda

commit e6f3cc4246a86279ca963b589b8dc9dd15714cda
Author: Matt Turner <[email protected]>
Date:   Mon Aug 10 15:09:09 2026 -0400

    elf: build the IFUNC resolver stack protector tests only with ssp
    
    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  <[email protected]>

Diff:
---
 elf/Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/elf/Makefile b/elf/Makefile
index d279a5135c..dbc6cfec7f 100644
--- a/elf/Makefile
+++ b/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 \
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.