[binutils-gdb] ld: Replace "{dummy.s}" with "[list $dummy_s]"

H.J. Lu hjl@sourceware.org
Fri Aug 28 21:02:45 GMT 2026


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

commit 609736de20383e69a9c586b1320a34798961daca
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Aug 29 04:24:13 2026 +0800

    ld: Replace "{dummy.s}" with "[list $dummy_s]"
    
    commit d658ddcc389085970ac025414cae7ad908f40726
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Fri Aug 28 09:08:39 2026 +0800
    
        lto: Don't check format of IR dummy file
    
    added
    
            .section .note.GNU-stack,"",%progbits
    
    to testsuite/ld-plugin/dummy.s for PR ld/34572 tests with Clang.  But
    it doesn't work for non-ELF targets.  Add dummy-elf.s and restore the
    previous dummy.s.  Define dummy_s to dummy-elf.s for ELF targets and to
    dummy.s for non-ELF targets.  Replace "{dummy.s}" with "[list $dummy_s]".
    Also build pr28264.so only for ELF targets since it uses readelf.
    
            PR ld/28264
            PR ld/34572
            * testsuite/ld-plugin/dummy-elf.s: New file.
            * testsuite/ld-plugin/dummy.s: Revert commit d658ddcc389.
            * testsuite/ld-plugin/lto.exp (dummy_s): New.
            Build pr28264.so only for ELF targets.
            Replace "{dummy.s}" with "[list $dummy_s]".
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 ld/testsuite/ld-plugin/dummy-elf.s |  1 +
 ld/testsuite/ld-plugin/dummy.s     |  2 +-
 ld/testsuite/ld-plugin/lto.exp     | 36 ++++++++++++++++++++++++------------
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/ld/testsuite/ld-plugin/dummy-elf.s b/ld/testsuite/ld-plugin/dummy-elf.s
new file mode 100644
index 00000000000..0f5ab47ca42
--- /dev/null
+++ b/ld/testsuite/ld-plugin/dummy-elf.s
@@ -0,0 +1 @@
+	.section	.note.GNU-stack,"",%progbits
diff --git a/ld/testsuite/ld-plugin/dummy.s b/ld/testsuite/ld-plugin/dummy.s
index 0f5ab47ca42..8b137891791 100644
--- a/ld/testsuite/ld-plugin/dummy.s
+++ b/ld/testsuite/ld-plugin/dummy.s
@@ -1 +1 @@
-	.section	.note.GNU-stack,"",%progbits
+
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index faa7c68770d..ffb567e96e4 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -51,6 +51,12 @@ if { [check_lto_fat_available] } {
   set no_lto "-fno-lto"
 }
 
+if { [is_elf_format] } {
+    set dummy_s "dummy-elf.s"
+} else {
+    set dummy_s "dummy.s"
+}
+
 set as_gsframe ""
 if { [gas_sframe_check] } {
     set as_gsframe "-Wa,--gsframe"
@@ -284,16 +290,21 @@ if { [at_least_gcc_version 10 0] && [check_lto_shared_available] } {
 	 "-flto -fno-common $lto_no_fat" \
 	 {pr25355.c} \
 	 [list [list "nm" "$plug_opt" "pr25355.d"]]] \
-	[list "pr28264.so" \
-	 "-shared -Wl,--version-script=pr28264.ver" \
-	 "-flto $lto_no_fat -fPIC" \
-	 {pr28264.c} \
-	 {{readelf {--dyn-syms --wide} pr28264-1.d} \
-	  {readelf {--dyn-syms --wide} pr28264-2.d} \
-	  {readelf {--dyn-syms --wide} pr28264-3.d} \
-	  {readelf {--dyn-syms --wide} pr28264-4.d}} \
-	 {pr28264.so}] \
     ]]
+
+    if { [is_elf_format] } {
+	lappend lto_link_tests [list \
+	    "pr28264.so" \
+	    "-shared -Wl,--version-script=pr28264.ver" \
+	    "-flto $lto_no_fat -fPIC" \
+	    {pr28264.c} \
+	    {{readelf {--dyn-syms --wide} pr28264-1.d} \
+	     {readelf {--dyn-syms --wide} pr28264-2.d} \
+	     {readelf {--dyn-syms --wide} pr28264-3.d} \
+	     {readelf {--dyn-syms --wide} pr28264-4.d}} \
+	    {pr28264.so}] \
+	]
+    }
 }
 
 if { [at_least_gcc_version 4 7] } {
@@ -1179,7 +1190,7 @@ run_cc_link_tests $lto_link_symbol_tests
 run_ld_link_tests [list \
   [list "PR ld/19317 (2)" \
    "-r tmpdir/pr19317.o --no-error-execstack" "" "" \
-   {dummy.s} {} "pr19317-r.o"] \
+   [list $dummy_s] {} "pr19317-r.o"] \
 ]
 
 run_ld_link_exec_tests $lto_run_tests
@@ -1456,6 +1467,7 @@ proc llvm_lto_tests {} {
     global CC_FOR_TARGET
     global CLANG_FOR_TARGET
     global llvm_plug_opt
+    global dummy_s
 
     # Skip native x32 and i?86 targets since system LLVMgold.so may not
     # be compatible with native x32 and i?86 targets binutils.
@@ -1494,7 +1506,7 @@ proc llvm_lto_tests {} {
 	    "Build pr34572a.exe" \
 	    "-flto -Wl,--start-lib tmpdir/pr34572a.o -Wl,--end-lib" \
 	    "" \
-	    {dummy.s} \
+	    [list $dummy_s] \
 	    {} \
 	    "pr34572a.exe"
 	] \
@@ -1517,7 +1529,7 @@ proc llvm_lto_tests {} {
 	    "$llvm_plug_opt --start-lib tmpdir/pr34572b.o --end-lib" \
 	    "" \
 	    "" \
-	    {dummy.s} \
+	    [list $dummy_s] \
 	    {{readelf {-sW} pr34572.rd}} \
 	    "pr34572b.exe" \
 	] \


More information about the Binutils-cvs mailing list