[binutils-gdb] ld testsuite alpha_ld_flags

Alan Modra via Binutils-cvs <[email protected]> Tue, 30 Jun 2026 03:52:00 +0000 (GMT)
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74388a1732853e6bdc72220889d4ea70817e6bbc

commit 74388a1732853e6bdc72220889d4ea70817e6bbc
Author: Alan Modra <[email protected]>
Date:   Tue Jun 30 12:26:46 2026 +0930

    ld testsuite alpha_ld_flags
    
    This is how alpha can use -Ttext-segment on just those tests that need
    it.  And since the way run_dump_test uses $opts(ld) allows tcl procs to
    be embedded, there is no need to specially expand [big_or_little_endian].
    
    binutils/
            * testsuite/lib/binutils-common.exp (run_dump_test <opts(ld)>): No
            need to handle big_or_little_endian specially.
    ld/
            * testsuite/ld-elf/elf.exp (alpha_ld_flags): New proc.
            (LDFLAGS): Don't set -Ttext-segment for alpha globally.
            * testsuite/ld-elf/compress1a.d: Add alpha_ld_flags.
            * testsuite/ld-elf/compressed1a.d: Likewise.
            * testsuite/ld-elf/eh5.d: Likewise.

Diff:
---
 binutils/testsuite/lib/binutils-common.exp |  3 ---
 ld/testsuite/ld-elf/compress1a.d           |  2 +-
 ld/testsuite/ld-elf/compressed1a.d         |  2 +-
 ld/testsuite/ld-elf/eh5.d                  |  2 +-
 ld/testsuite/ld-elf/elf.exp                | 12 ++++++++----
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 8a484454e65..48c6f46bd1c 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -1242,9 +1242,6 @@ proc run_dump_test { name {extra_options {}} } {
 	lappend as_final_flags $x
     }
 
-    regsub {\[big_or_little_endian\]} $opts(ld) \
-	[big_or_little_endian] opts(ld)
-
     if { $opts(name) == "" } {
 	set base_testname "$subdir/$name"
     } else {
diff --git a/ld/testsuite/ld-elf/compress1a.d b/ld/testsuite/ld-elf/compress1a.d
index 44f35aacf15..8e29d01f20b 100644
--- a/ld/testsuite/ld-elf/compress1a.d
+++ b/ld/testsuite/ld-elf/compress1a.d
@@ -1,6 +1,6 @@
 #source: compress1.s
 #as: --compress-debug-sections
-#ld: -e func_cu2
+#ld: -e func_cu2 [alpha_ld_flags]
 #readelf: -S --wide
 #xfail: alpha-*-*ecoff
 # PR ld/25802
diff --git a/ld/testsuite/ld-elf/compressed1a.d b/ld/testsuite/ld-elf/compressed1a.d
index e9a7e3b842f..2ffe9413db3 100644
--- a/ld/testsuite/ld-elf/compressed1a.d
+++ b/ld/testsuite/ld-elf/compressed1a.d
@@ -1,6 +1,6 @@
 #source: compress1.s
 #as: --compress-debug-sections=zlib-gabi
-#ld: -e func_cu2
+#ld: -e func_cu2 [alpha_ld_flags]
 #readelf: -t
 #xfail: alpha-*-*ecoff
 # PR ld/25802
diff --git a/ld/testsuite/ld-elf/eh5.d b/ld/testsuite/ld-elf/eh5.d
index 48109d38310..266e6f31621 100644
--- a/ld/testsuite/ld-elf/eh5.d
+++ b/ld/testsuite/ld-elf/eh5.d
@@ -1,7 +1,7 @@
 #source: eh5.s
 #source: eh5a.s
 #source: eh5b.s
-#ld:
+#ld: [alpha_ld_flags]
 #readelf: -wf
 #target: [check_as_cfi]
 #xfail: alpha-*-*ecoff tile*-*-* visium-*-*
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 51b8c942648..337206318ab 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -51,11 +51,15 @@ if [istarget "*-*-hpux*"] {
     set ASFLAGS "$ASFLAGS --defsym HPUX=1"
 }
 
+# Some tests expect 32-bit addresses.  Force the executable to low addresses.
+proc alpha_ld_flags { } {
+    if { [istarget alpha*-*-* ] } {
+	return "-Ttext-segment 0x1000000"
+    }
+    return ""
+}
+
 if { [istarget alpha*-*-* ] } {
-    # The compress1 test is written expecting 32-bit addresses; force the
-    # executable down into the low address space to match.
-    # ??? How can we adjust just the one testcase?
-    set LDFLAGS "$LDFLAGS -Ttext-segment 0x1000000"
     set ASFLAGS "$ASFLAGS --defsym NO_SET=1"
 }