aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-09-04 06:57:06 -0700
committerH.J. Lu <hjl.tools@gmail.com>2025-09-07 05:38:34 -0700
commit9546c98be0581f4e93efacafd7fe22427edd3635 (patch)
tree943801a1da7f495f63fedb836ee59995c925b4ca /ld
parent5c9a05428ddd88be3321c35b74fe2e8dc92bd1a3 (diff)
downloadfsf-binutils-gdb-master.zip
fsf-binutils-gdb-master.tar.gz
fsf-binutils-gdb-master.tar.bz2
ld: Limit "readelf --got-contents" testsHEADmaster
Since "readelf --got-contents" tests use -melf_i386, -melf_x86_64 and -melf32_x86_64 emulations, limit theses tests to linker supporting those emulations, pass --rosegment to linker and output libgot-1-i386.so, libgot-1-x64.so, libgot-1-x32.so. PR ld/33350 * testsuite/ld-i386/binutils.exp: Limit tests to linker with -melf_i386 support, pass --rosegment to linker and output libgot-1-i386.so. * testsuite/ld-x86-64/binutils.exp: Limit -melf_x86_64 tests to linker with -melf_x86_64 support, limit -melf32_x86_64 tests to linker with -melf32_x86_64 support, pass --rosegment to linker and output libgot-1-x64.so/libgot-1-x32.so. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-i386/binutils.exp36
-rw-r--r--ld/testsuite/ld-x86-64/binutils.exp73
2 files changed, 63 insertions, 46 deletions
diff --git a/ld/testsuite/ld-i386/binutils.exp b/ld/testsuite/ld-i386/binutils.exp
index 5069c59..1138448 100644
--- a/ld/testsuite/ld-i386/binutils.exp
+++ b/ld/testsuite/ld-i386/binutils.exp
@@ -27,19 +27,23 @@ if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
return
}
-run_ld_link_tests [list \
- [list \
- "Build libgot-1.so" \
- "-shared -melf_i386 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
- $NO_DT_RELR_LDFLAGS" \
- "" \
- "--32 -mx86-used-note=no --generate-missing-build-notes=no" \
- {got-1.s} \
- {{readelf -rW libgot-1a.rd} \
- {readelf -aW libgot-1b.rd} \
- {readelf --got-contents libgot-1c.rd} \
- {readelf {--got-contents -W} libgot-1d.rd}} \
- "libgot-1.so" \
- ] \
-]
+# Tests here need -melf_i386 support.
+set status [catch "exec $LD -V -melf_i386" got]
+if { $status == 0 } {
+ run_ld_link_tests [list \
+ [list \
+ "Build libgot-1-i386.so" \
+ "-shared -melf_i386 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 \
+ --rosegment --hash-style=sysv $NO_DT_RELR_LDFLAGS" \
+ "" \
+ "--32 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a.rd} \
+ {readelf -aW libgot-1b.rd} \
+ {readelf --got-contents libgot-1c.rd} \
+ {readelf {--got-contents -W} libgot-1d.rd}} \
+ "libgot-1-i386.so" \
+ ] \
+ ]
+}
diff --git a/ld/testsuite/ld-x86-64/binutils.exp b/ld/testsuite/ld-x86-64/binutils.exp
index fef9973..4a0b211 100644
--- a/ld/testsuite/ld-x86-64/binutils.exp
+++ b/ld/testsuite/ld-x86-64/binutils.exp
@@ -27,33 +27,46 @@ if { ![istarget "x86_64-*-*"] } {
return
}
-run_ld_link_tests [list \
- [list \
- "Build libgot-1.so" \
- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
- -z nomark-plt $NO_DT_RELR_LDFLAGS" \
- "" \
- "--64 -mx86-used-note=no --generate-missing-build-notes=no" \
- {got-1.s} \
- {{readelf -rW libgot-1a.rd} \
- {readelf -aW libgot-1b.rd} \
- {readelf --got-contents libgot-1c.rd} \
- {readelf {--got-contents -W} libgot-1d.rd}} \
- "libgot-1.so" \
- ] \
- [list \
- "Build libgot-1-x32.so" \
- "-shared -melf32_x86_64 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
- -z nomark-plt $NO_DT_RELR_LDFLAGS" \
- "" \
- "--x32 -mx86-used-note=no --generate-missing-build-notes=no" \
- {got-1.s} \
- {{readelf -rW libgot-1a-x32.rd} \
- {readelf -aW libgot-1b-x32.rd} \
- {readelf --got-contents libgot-1c-x32.rd} \
- {readelf {--got-contents -W} libgot-1d-x32.rd}} \
- "libgot-1-x32.so" \
- ] \
-]
+# Tests here need -melf_x86_64 support.
+set status [catch "exec $LD -V -melf_x86_64" got]
+if { $status == 0 } {
+ run_ld_link_tests [list \
+ [list \
+ "Build libgot-1-x64.so" \
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 \
+ --hash-style=sysv -z nomark-plt $NO_DT_RELR_LDFLAGS \
+ --rosegment" \
+ "" \
+ "--64 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a.rd} \
+ {readelf -aW libgot-1b.rd} \
+ {readelf --got-contents libgot-1c.rd} \
+ {readelf {--got-contents -W} libgot-1d.rd}} \
+ "libgot-1-x64.so" \
+ ] \
+ ]
+}
+
+# Tests here need -melf32_x86_64 support.
+set status [catch "exec $LD -V -melf32_x86_64" got]
+if { $status == 0 } {
+ run_ld_link_tests [list \
+ [list \
+ "Build libgot-1-x32.so" \
+ "-shared -melf32_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 \
+ --hash-style=sysv -z nomark-plt $NO_DT_RELR_LDFLAGS \
+ --rosegment" \
+ "" \
+ "--x32 -mx86-used-note=no --generate-missing-build-notes=no" \
+ {got-1.s} \
+ {{readelf -rW libgot-1a-x32.rd} \
+ {readelf -aW libgot-1b-x32.rd} \
+ {readelf --got-contents libgot-1c-x32.rd} \
+ {readelf {--got-contents -W} libgot-1d-x32.rd}} \
+ "libgot-1-x32.so" \
+ ] \
+ ]
+}