[PATCH] LD/testsuite: Remove $LDFLAGS reference from `run_ld_link_tests'

"Maciej W. Rozycki" <[email protected]> Tue, 21 Jul 2026 15:02:36 +0100 (BST)
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
Fix commit 24602a75d128 ("ld: Append LDFLAGS to flags variable in 
default_ld_link") and prevent $LDFLAGS from being included twice in LD 
invocations made via `run_ld_link_tests', effectively reverting that 
part of commit 740341b9be65 ("Provide dummy libraries for alpha-vms").
---
This just implements what was discussed (in the last sentence) in 
<https://inbox.sourceware.org/binutils/[email protected]/>, 
but somehow missed from the final change committed.  No regressions in 
`hppa64-hp-hpux11.23' testing, log output correctly matches expectations:

-.../ld/ld-new    -Ltmpdir/hppa -o tmpdir/abwc  -Ltmpdir/hppa -z nomemory-seal -L.../ld/testsuite/ld-archive -e ff tmpdir/abc.o --whole-archive tmpdir/ab.a --verbose --print-map
-Executing on host: sh -c {.../ld/ld-new    -Ltmpdir/hppa -o tmpdir/abwc  -Ltmpdir/hppa -z nomemory-seal -L.../ld/testsuite/ld-archive -e ff tmpdir/abc.o --whole-archive tmpdir/ab.a --verbose --print-map 2>&1}  /dev/null ld.tmp (timeout = 300)
+.../ld/ld-new    -Ltmpdir/hppa -o tmpdir/abwc  -z nomemory-seal -L.../ld/testsuite/ld-archive -e ff tmpdir/abc.o --whole-archive tmpdir/ab.a --verbose --print-map
+Executing on host: sh -c {.../ld/ld-new    -Ltmpdir/hppa -o tmpdir/abwc  -z nomemory-seal -L.../ld/testsuite/ld-archive -e ff tmpdir/abc.o --whole-archive tmpdir/ab.a --verbose --print-map 2>&1}  /dev/null ld.tmp (timeout = 300)

etc. (notice `-Ltmpdir/hppa' included twice in the first invocation and 
once only in the second).
---
 ld/testsuite/lib/ld-lib.exp |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

binutils-ld-test-run-ld-link-tests-ldflags.diff
Index: binutils-gdb/ld/testsuite/lib/ld-lib.exp
===================================================================
--- binutils-gdb.orig/ld/testsuite/lib/ld-lib.exp
+++ binutils-gdb/ld/testsuite/lib/ld-lib.exp
@@ -511,7 +511,6 @@ proc ar_simple_create { ar aropts target
 #
 proc run_ld_link_tests { ldtests args } {
     global ld
-    global LDFLAGS
     global as
     global nm
     global ar
@@ -524,7 +523,7 @@ proc run_ld_link_tests { ldtests args }
     global runtests
     global exec_output
 
-    set ld_extra_opt $LDFLAGS
+    set ld_extra_opt ""
     if [check_relro_support] {
 	append ld_extra_opt " -z norelro"
     }