[PATCH] ld/testsuite: exclude relocs from section contributions PDB test

Mark Harmstone mark@harmstone.com
Mon Sep 9 21:05:27 GMT 2024


A bug in ld meant that we were erroneously generating image relocations
for .secrel32 ops, which we then reflected in our PDB section
contributions because the linker was adding a .reloc section.

This was incidental to what we were testing for, so pass
--disable-reloc-section to ld in order to ensure a consistent output.
---
 ld/testsuite/ld-pe/pdb.exp                | 22 +---------------------
 ld/testsuite/ld-pe/pdb2-section-contrib.d |  4 +---
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/ld/testsuite/ld-pe/pdb.exp b/ld/testsuite/ld-pe/pdb.exp
index 7ca0fb66246..b530e0a639d 100644
--- a/ld/testsuite/ld-pe/pdb.exp
+++ b/ld/testsuite/ld-pe/pdb.exp
@@ -611,26 +611,6 @@ proc test_mod_info { mod_info } {
     if { [expr $off % 4] != 0 } {
 	set off [expr $off + 4 - ($off % 4)]
     }
-
-    incr off 64
-
-    set obj3 [string range $mod_info $off [expr [string first \000 $mod_info $off] - 1]]
-    incr off [expr [string length $obj3] + 1]
-
-    set ar3 [string range $mod_info $off [expr [string first \000 $mod_info $off] - 1]]
-    incr off [expr [string length $ar3] + 1]
-
-    if [string equal $obj3 "* Linker *"] {
-	pass "Correct name for dummy object file"
-    } else {
-	fail "Incorrect name for dummy object file"
-    }
-
-    if [string equal $ar3 ""] {
-	pass "Correct archive name for dummy object file"
-    } else {
-	fail "Incorrect archive name for dummy object file"
-    }
 }
 
 proc test_section_contrib { section_contrib } {
@@ -677,7 +657,7 @@ proc test2 { } {
 	return
     }
 
-    if ![ld_link $ld "tmpdir/pdb2.exe" "--pdb=tmpdir/pdb2.pdb --gc-sections -e foo tmpdir/pdb2a.o tmpdir/pdb2b.a"] {
+    if ![ld_link $ld "tmpdir/pdb2.exe" "--pdb=tmpdir/pdb2.pdb --gc-sections --disable-reloc-section -e foo tmpdir/pdb2a.o tmpdir/pdb2b.a"] {
 	unsupported "Create PE image with PDB file"
 	return
     }
diff --git a/ld/testsuite/ld-pe/pdb2-section-contrib.d b/ld/testsuite/ld-pe/pdb2-section-contrib.d
index 5b1df9fd931..214eb11d3fb 100644
--- a/ld/testsuite/ld-pe/pdb2-section-contrib.d
+++ b/ld/testsuite/ld-pe/pdb2-section-contrib.d
@@ -7,6 +7,4 @@ Contents of section .data:
  0020 01000000 10000000 10000000 20000060  ............ ..`
  0030 01000000 00000000 00000000 02000000  ................
  0040 00000000 3d000000 40000040 00000000  ....=...@..@....
- 0050 00000000 00000000 04000000 00000000  ................
- 0060 0c000000 40000042 02000000 00000000  ....@..B........
- 0070 00000000                             ....            
+ 0050 00000000 00000000                    ........        
-- 
2.44.2



More information about the Binutils mailing list