[binutils-gdb] ld-elf/shared libpr23161c and pr23161c tests

Alan Modra amodra@sourceware.org
Fri Aug 1 01:16:51 GMT 2025


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

commit ce6a13a42fb3191debdc1d01c13e979beb6714aa
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Jul 31 21:40:12 2025 +0930

    ld-elf/shared libpr23161c and pr23161c tests
    
    If I understand these tests correctly it is to ensure that _end,
    _edata and __bss_start are not made dynamic.  The dynamic reloc tests
    are not really necessary.  (We dropped them from pr23161a and pr23161b
    tests a while ago without removing the -r from readelf invocation.)
    Dropping the reloc tests allows them to run for more targets.
    
            * testsuite/ld-elf/pr23161c.rd: Rewrite.
            * testsuite/ld-elf/pr23161d.rd: Delete.
            * testsuite/ld-elf/shared.exp (pr23161a, pr23161b): Remove -r
            from readelf check.
            (libpr23161c.so, pr23161c): Likewise, and check expected readelf
            output using the new pr23161c.rd.

Diff:
---
 ld/testsuite/ld-elf/pr23161c.rd |  9 +++------
 ld/testsuite/ld-elf/pr23161d.rd |  8 --------
 ld/testsuite/ld-elf/shared.exp  | 14 ++++----------
 3 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/ld/testsuite/ld-elf/pr23161c.rd b/ld/testsuite/ld-elf/pr23161c.rd
index be99655e7ab..9b19b366aa8 100644
--- a/ld/testsuite/ld-elf/pr23161c.rd
+++ b/ld/testsuite/ld-elf/pr23161c.rd
@@ -1,6 +1,3 @@
-There are no relocations in this file.
-
-Symbol table '\.dynsym' contains [0-9]+ entries:
- +Num: +Value +Size Type +Bind +Vis +Ndx Name
- +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
- +1: +[a-f0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo
+#failif
+#...
+.* _?_(end|edata|_bss_start)
diff --git a/ld/testsuite/ld-elf/pr23161d.rd b/ld/testsuite/ld-elf/pr23161d.rd
deleted file mode 100644
index e7756b3f61b..00000000000
--- a/ld/testsuite/ld-elf/pr23161d.rd
+++ /dev/null
@@ -1,8 +0,0 @@
-Relocation section '\.rel(a|)\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
- +Offset +Info +Type +Sym.* Value +Sym.* Name( \+ Addend|)
-[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ [a-f0-9]+|)
-
-Symbol table '\.dynsym' contains [0-9]+ entries:
- +Num: +Value +Size Type +Bind +Vis +Ndx Name
- +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
- +[0-9]+: +[a-f0-9]+ +0 +FUNC +GLOBAL +DEFAULT +UND +foo
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 84100a7e6d9..ee881c2d619 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -1764,7 +1764,7 @@ if { ([istarget "*-*-linux*"]
 	    "" \
 	    $AFLAGS_PIE \
 	    { pr23161b.c } \
-	    {{readelf {--dyn-syms -rW} pr23161b.rd}} \
+	    {{readelf {--dyn-syms -W} pr23161b.rd}} \
 	    "pr23161a" \
 	    "-fPIC -O0 $NOSANITIZE_CFLAGS" \
 	] \
@@ -1784,23 +1784,17 @@ if { ([istarget "*-*-linux*"]
 	    "" \
 	    $AFLAGS_PIE \
 	    { pr23161b.c } \
-	    {{readelf {--dyn-syms -rW} pr23161b.rd}} \
+	    {{readelf {--dyn-syms -W} pr23161b.rd}} \
 	    "pr23161b" \
 	    "-fPIC -O0 $NOSANITIZE_CFLAGS" \
 	] \
-    ]
-}
-
-if { [istarget "i?86-*-*"]
-     || [istarget "x86_64-*-*"] } {
-    run_ld_link_tests [list \
 	[list \
 	    "Build libpr23161c.so" \
 	    "-shared" \
 	    "" \
 	    "$AFLAGS_PIC" \
 	    { pr23161c.c } \
-	    {{readelf {--dyn-syms -rW} pr23161c.rd}} \
+	    {{readelf {--dyn-syms -W} pr23161c.rd}} \
 	    "libpr23161c.so" \
 	    "-fPIC -O2 $NOSANITIZE_CFLAGS" \
 	] \
@@ -1810,7 +1804,7 @@ if { [istarget "i?86-*-*"]
 	    "" \
 	    $AFLAGS_PIE \
 	    { pr23161b.c } \
-	    {{readelf {--dyn-syms -rW} pr23161d.rd}} \
+	    {{readelf {--dyn-syms -W} pr23161c.rd}} \
 	    "pr23161c" \
 	    "-fPIC -O0 $NOSANITIZE_CFLAGS" \
 	] \


More information about the Binutils-cvs mailing list