[binutils-gdb] ld: Append LDFLAGS to flags variable in default_ld_link

John David Anglin danglin@sourceware.org
Thu May 7 21:44:39 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=24602a75d1288d0c8832f26c431f7899db7f726d

commit 24602a75d1288d0c8832f26c431f7899db7f726d
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Thu May 7 17:43:54 2026 -0400

    ld: Append LDFLAGS to flags variable in default_ld_link
    
    The following change is needed to fix errors trying to load the
    milli.a archive for the hppa*64*-*-hpux* target when the host
    system isn't hpux.
    
    We need to create a dummy milli.a archive for this target and
    append the directory of this archive to LDFLAGS.
    
    This assumes the testsuite takes the LDFLAGS environment variable
    into account.  However, some tests in the ld testsuite use the
    low-level `ld-link' procedure and it fails to take LDFLAGS into
    account.
    
    This change modifies the `default_ld_link' procedure to append
    $LDFLAGS to the flags variable and fix the above issue.
    
    This change potentially affects the `alpha*-*-*vms*' target but
    currently no tests run for it make direct use of `ld-link'.
    
    Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
    
    2026-04-27  John David Anglin  <danglin@gcc.gnu.org>
    
    ld/ChangeLog:
    
            * testsuite/lib/ld-lib.exp (default_ld_link): Append
            LDFLAGS to `flags' variable.  Also use the append command
            to append the board flags.

Diff:
---
 ld/testsuite/lib/ld-lib.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index d37d33cd96c..5da81424cb5 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -231,11 +231,13 @@ proc get_board_flags {} {
 proc default_ld_link { ld target objects } {
     global host_triplet
     global exec_output
+    global LDFLAGS
 
     set flags ""
     if [is_endian_output_format $objects] then {
 	set flags [big_or_little_endian]
     }
+    append flags " $LDFLAGS"
 
     # When using GCC as the linker driver, we need to specify board cflags when
     # linking because cflags may contain linker options.  For example when
@@ -245,7 +247,7 @@ proc default_ld_link { ld target objects } {
     if {[string match "*cc*" $gccexe] ||
 	[string match "*++*" $gccexe] ||
 	[string match "clang*" $gccexe]} then {
-	set flags "$flags [get_board_flags]"
+	append flags " [get_board_flags]"
     }
 
     remote_file host delete $target


More information about the Binutils-cvs mailing list