[COMMITTED, PATCH] ld: Replace "{dummy.s}" with "[list $dummy_s]"

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAMe9rOoENgS6HmAmCBnMtVC6fHnK0zEYU6DoVjjpNfaYbVFHRg@mail.gmail.com>
On Fri, Aug 28, 2026 at 8:29 PM Alan Modra <[email protected]> wrote:
>
> On Fri, Aug 28, 2026 at 04:24:48PM +0800, H.J. Lu wrote:
> > I am checking this patch after testing with x86_64-w64-mingw32.
>
> Fails remain.
>
> +FAIL: ld-plugin/lto-3r
> +FAIL: ld-plugin/lto-4r-a
> +FAIL: ld-plugin/lto-4r-b
> +FAIL: ld-plugin/lto-4r-c
> +FAIL: ld-plugin/lto-4r-d
> +FAIL: ld-plugin/lto-5r
> +FAIL: ld-plugin/lto-10r
> +FAIL: PR ld/19317 (2)
> +FAIL: LTO 3b
> +FAIL: PR ld/19317 (3)
>
> ld-plugin/dummy.s: Assembler messages:
> ld-plugin/dummy.s:1: Error: junk at end of line, first unrecognized character is `-
> '
>
> The above also caused a bunch of tests to not be run.
>
> --
> Alan Modra

I am checking in this patch.

-- 
H.J.
---
commit d658ddcc389085970ac025414cae7ad908f40726
Author: H.J. Lu <[email protected]>
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]".
0001-ld-Replace-dummy.s-with-list-dummy_s.patch (text/x-patch, 4 KB)
From 6a767489f77766496a4359caed5f7b1fa8eada2a Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <[email protected]>
Date: Sat, 29 Aug 2026 04:24:13 +0800
Subject: [PATCH] ld: Replace "{dummy.s}" with "[list $dummy_s]"

commit d658ddcc389085970ac025414cae7ad908f40726
Author: H.J. Lu <[email protected]>
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 <[email protected]>
---
 ld/testsuite/ld-plugin/dummy-elf.s |  1 +
 ld/testsuite/ld-plugin/dummy.s     |  2 +-
 ld/testsuite/ld-plugin/lto.exp     | 35 ++++++++++++++++++++----------
 3 files changed, 25 insertions(+), 13 deletions(-)
 create mode 100644 ld/testsuite/ld-plugin/dummy-elf.s

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..a4975a0822d 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
@@ -1494,7 +1505,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 +1528,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" \
 	] \
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.