[PATCH 5/5] x86: Pass $NOPIE_LDFLAGS to undefined weak tests

Jens Remus jremus@linux.ibm.com
Fri Mar 21 16:50:49 GMT 2025


Some distributions configure GCC with --enable-default-pie, so that it
defaults to compile with -fPIE and link with -pie, which is unexpected
by some of the tests.  Therefore link the PDE test programs with
$NOPIE_LDFLAGS to disable PIE.

This complements commit a7eaf017f959 ("Use NOPIE_CFLAGS and
NOPIE_LDFLAGS to disable PIE").

ld/testsuite/
	PR ld/21090
	* ld-x86-64/x86-64.exp (undefined_weak): Use NOPIE_LDFLAGS to
	disable PIE for the non-PIE versions of the test.

Bug: https://sourceware.org/PR21090
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 ld/testsuite/ld-x86-64/x86-64.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 01d6459b5d79..52c4d5e0e6bb 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -2168,9 +2168,9 @@ if { [isnative] && [check_compiler_available] } {
     }
 
     undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
-    undefined_weak "-fPIE" ""
+    undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
     undefined_weak "-fPIE" "-pie"
-    undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
+    undefined_weak "-fPIE" "$NOPIE_LDFLAGS -Wl,-z,nodynamic-undefined-weak"
     undefined_weak "-fPIE" "-pie -Wl,-z,nodynamic-undefined-weak"
 }
 
-- 
2.45.2



More information about the Binutils mailing list