[07/10] elf: Support DT_RELR in linker tests
Checks
Commit Message
Allow eabling and disabling DT_RELR in linker tests. Disable DT_RELR in
linker tests which don't expect DT_RELR in linker outputs.
binutils/
* testsuite/lib/binutils-common.exp (run_dump_test): Make
DT_RELR_LDFLAGS and NO_DT_RELR_LDFLAGS global.
ld/
* testsuite/config/default.exp (DT_RELR_LDFLAGS): New.
(DT_RELR_CC_LDFLAGS): Likewise.
(NO_DT_RELR_LDFLAGS): Likewise.
(NO_DT_RELR_CC_LDFLAGS): Likewise.
* testsuite/ld-elf/shared.exp: Pass $NO_DT_RELR_LDFLAGS to
linker for some tests.
* testsuite/ld-i386/export-class.exp: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-i386/ibt-plt-2a.d: Pass $NO_DT_RELR_LDFLAGS to
linker.
* testsuite/ld-i386/ibt-plt-3a.d: Likewise.
* testsuite/ld-i386/ibt-plt-3c.d: Likewise.
* testsuite/ld-i386/report-reloc-1.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/load1c.d: Likewise.
* testsuite/ld-x86-64/load1d.d: Likewise.
* testsuite/ld-x86-64/pr13082-2b.d: Likewise.
* testsuite/ld-x86-64/pr14207.d: Likewise.
* testsuite/ld-x86-64/pr18176.d: Likewise.
* testsuite/ld-x86-64/pr19162.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
* testsuite/ld-x86-64/pr20253-1f.d: Likewise.
* testsuite/ld-x86-64/pr20253-1j.d: Likewise.
* testsuite/ld-x86-64/pr20253-1l.d: Likewise.
* testsuite/ld-x86-64/report-reloc-1-x32.d: Likewise.
* testsuite/ld-x86-64/report-reloc-1.d: Likewise.
* testsuite/ld-x86-64/export-class.exp (x86_64_export_class_test):
Pass $NO_DT_RELR_LDFLAGS to linker.
* testsuite/ld-x86-64/x86-64.exp: Pass $NO_DT_RELR_LDFLAGS to
linker for some tests.
---
binutils/testsuite/lib/binutils-common.exp | 1 +
ld/testsuite/config/default.exp | 16 +++++
ld/testsuite/ld-elf/shared.exp | 3 +-
ld/testsuite/ld-i386/export-class.exp | 2 +-
ld/testsuite/ld-i386/i386.exp | 20 ++++--
ld/testsuite/ld-i386/ibt-plt-2a.d | 2 +-
ld/testsuite/ld-i386/ibt-plt-3a.d | 2 +-
ld/testsuite/ld-i386/ibt-plt-3c.d | 2 +-
ld/testsuite/ld-i386/report-reloc-1.d | 2 +-
ld/testsuite/ld-ifunc/ifunc-2-i386-now.d | 2 +-
.../ld-ifunc/ifunc-2-local-i386-now.d | 2 +-
.../ld-ifunc/ifunc-2-local-x86-64-now.d | 2 +-
ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d | 2 +-
ld/testsuite/ld-ifunc/pr17154-x86-64-now.d | 2 +-
ld/testsuite/ld-ifunc/pr17154-x86-64.d | 2 +-
ld/testsuite/ld-x86-64/bnd-branch-1-now.d | 2 +-
ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d | 2 +-
ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d | 2 +-
ld/testsuite/ld-x86-64/bnd-ifunc-2.d | 2 +-
ld/testsuite/ld-x86-64/bnd-plt-1-now.d | 2 +-
ld/testsuite/ld-x86-64/bnd-plt-1.d | 2 +-
ld/testsuite/ld-x86-64/export-class.exp | 3 +-
ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d | 2 +-
ld/testsuite/ld-x86-64/ibt-plt-2a.d | 2 +-
ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d | 2 +-
ld/testsuite/ld-x86-64/ibt-plt-3a.d | 2 +-
ld/testsuite/ld-x86-64/ilp32-4.d | 2 +-
ld/testsuite/ld-x86-64/load1c.d | 2 +-
ld/testsuite/ld-x86-64/load1d.d | 2 +-
ld/testsuite/ld-x86-64/pr13082-2b.d | 2 +-
ld/testsuite/ld-x86-64/pr14207.d | 2 +-
ld/testsuite/ld-x86-64/pr18176.d | 2 +-
ld/testsuite/ld-x86-64/pr19162.d | 2 +-
ld/testsuite/ld-x86-64/pr19636-2d.d | 2 +-
ld/testsuite/ld-x86-64/pr19636-2l.d | 2 +-
ld/testsuite/ld-x86-64/pr20253-1d.d | 2 +-
ld/testsuite/ld-x86-64/pr20253-1f.d | 2 +-
ld/testsuite/ld-x86-64/pr20253-1j.d | 2 +-
ld/testsuite/ld-x86-64/pr20253-1l.d | 2 +-
ld/testsuite/ld-x86-64/report-reloc-1-x32.d | 2 +-
ld/testsuite/ld-x86-64/report-reloc-1.d | 2 +-
ld/testsuite/ld-x86-64/x86-64.exp | 65 ++++++++++++-------
42 files changed, 114 insertions(+), 66 deletions(-)
Comments
On 2022-01-07, H.J. Lu via Binutils wrote:
>Allow eabling and disabling DT_RELR in linker tests. Disable DT_RELR in
>linker tests which don't expect DT_RELR in linker outputs.
>
>binutils/
>
> * testsuite/lib/binutils-common.exp (run_dump_test): Make
> DT_RELR_LDFLAGS and NO_DT_RELR_LDFLAGS global.
>
>ld/
>
> * testsuite/config/default.exp (DT_RELR_LDFLAGS): New.
> (DT_RELR_CC_LDFLAGS): Likewise.
> (NO_DT_RELR_LDFLAGS): Likewise.
> (NO_DT_RELR_CC_LDFLAGS): Likewise.
> * testsuite/ld-elf/shared.exp: Pass $NO_DT_RELR_LDFLAGS to
> linker for some tests.
> * testsuite/ld-i386/export-class.exp: Likewise.
> * testsuite/ld-i386/i386.exp: Likewise.
> * testsuite/ld-i386/ibt-plt-2a.d: Pass $NO_DT_RELR_LDFLAGS to
> linker.
> * testsuite/ld-i386/ibt-plt-3a.d: Likewise.
> * testsuite/ld-i386/ibt-plt-3c.d: Likewise.
> * testsuite/ld-i386/report-reloc-1.d: Likewise.
> * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
> * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
> * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
> * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
> * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
> * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
> * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
> * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
> * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
> * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
> * testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
> * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
> * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
> * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
> * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
> * testsuite/ld-x86-64/ilp32-4.d: Likewise.
> * testsuite/ld-x86-64/load1c.d: Likewise.
> * testsuite/ld-x86-64/load1d.d: Likewise.
> * testsuite/ld-x86-64/pr13082-2b.d: Likewise.
> * testsuite/ld-x86-64/pr14207.d: Likewise.
> * testsuite/ld-x86-64/pr18176.d: Likewise.
> * testsuite/ld-x86-64/pr19162.d: Likewise.
> * testsuite/ld-x86-64/pr19636-2d.d: Likewise.
> * testsuite/ld-x86-64/pr19636-2l.d: Likewise.
> * testsuite/ld-x86-64/pr20253-1d.d: Likewise.
> * testsuite/ld-x86-64/pr20253-1f.d: Likewise.
> * testsuite/ld-x86-64/pr20253-1j.d: Likewise.
> * testsuite/ld-x86-64/pr20253-1l.d: Likewise.
> * testsuite/ld-x86-64/report-reloc-1-x32.d: Likewise.
> * testsuite/ld-x86-64/report-reloc-1.d: Likewise.
> * testsuite/ld-x86-64/export-class.exp (x86_64_export_class_test):
> Pass $NO_DT_RELR_LDFLAGS to linker.
> * testsuite/ld-x86-64/x86-64.exp: Pass $NO_DT_RELR_LDFLAGS to
> linker for some tests.
>---
> binutils/testsuite/lib/binutils-common.exp | 1 +
> ld/testsuite/config/default.exp | 16 +++++
> ld/testsuite/ld-elf/shared.exp | 3 +-
> ld/testsuite/ld-i386/export-class.exp | 2 +-
> ld/testsuite/ld-i386/i386.exp | 20 ++++--
> ld/testsuite/ld-i386/ibt-plt-2a.d | 2 +-
> ld/testsuite/ld-i386/ibt-plt-3a.d | 2 +-
> ld/testsuite/ld-i386/ibt-plt-3c.d | 2 +-
> ld/testsuite/ld-i386/report-reloc-1.d | 2 +-
> ld/testsuite/ld-ifunc/ifunc-2-i386-now.d | 2 +-
> .../ld-ifunc/ifunc-2-local-i386-now.d | 2 +-
> .../ld-ifunc/ifunc-2-local-x86-64-now.d | 2 +-
> ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d | 2 +-
> ld/testsuite/ld-ifunc/pr17154-x86-64-now.d | 2 +-
> ld/testsuite/ld-ifunc/pr17154-x86-64.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-branch-1-now.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-ifunc-2.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-plt-1-now.d | 2 +-
> ld/testsuite/ld-x86-64/bnd-plt-1.d | 2 +-
> ld/testsuite/ld-x86-64/export-class.exp | 3 +-
> ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d | 2 +-
> ld/testsuite/ld-x86-64/ibt-plt-2a.d | 2 +-
> ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d | 2 +-
> ld/testsuite/ld-x86-64/ibt-plt-3a.d | 2 +-
> ld/testsuite/ld-x86-64/ilp32-4.d | 2 +-
> ld/testsuite/ld-x86-64/load1c.d | 2 +-
> ld/testsuite/ld-x86-64/load1d.d | 2 +-
> ld/testsuite/ld-x86-64/pr13082-2b.d | 2 +-
> ld/testsuite/ld-x86-64/pr14207.d | 2 +-
> ld/testsuite/ld-x86-64/pr18176.d | 2 +-
> ld/testsuite/ld-x86-64/pr19162.d | 2 +-
> ld/testsuite/ld-x86-64/pr19636-2d.d | 2 +-
> ld/testsuite/ld-x86-64/pr19636-2l.d | 2 +-
> ld/testsuite/ld-x86-64/pr20253-1d.d | 2 +-
> ld/testsuite/ld-x86-64/pr20253-1f.d | 2 +-
> ld/testsuite/ld-x86-64/pr20253-1j.d | 2 +-
> ld/testsuite/ld-x86-64/pr20253-1l.d | 2 +-
> ld/testsuite/ld-x86-64/report-reloc-1-x32.d | 2 +-
> ld/testsuite/ld-x86-64/report-reloc-1.d | 2 +-
> ld/testsuite/ld-x86-64/x86-64.exp | 65 ++++++++++++-------
> 42 files changed, 114 insertions(+), 66 deletions(-)
>
>diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
>index 0e0ba8e5aee..88fdc1a71c7 100644
>--- a/binutils/testsuite/lib/binutils-common.exp
>+++ b/binutils/testsuite/lib/binutils-common.exp
>@@ -855,6 +855,7 @@ proc run_dump_test { name {extra_options {}} } {
> global ELFEDIT ELFEDITFLAGS LD LDFLAGS NM NMFLAGS OBJCOPY OBJCOPYFLAGS
> global OBJDUMP OBJDUMPFLAGS READELF READELFFLAGS STRIP STRIPFLAGS
> global copyfile env runtests srcdir subdir verbose
>+ global DT_RELR_LDFLAGS NO_DT_RELR_LDFLAGS
>
> if [string match "*/*" $name] {
> set file $name
>diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
>index c988d5d2924..52e75048ede 100644
>--- a/ld/testsuite/config/default.exp
>+++ b/ld/testsuite/config/default.exp
>@@ -313,6 +313,22 @@ if ![info exists LDFLAGS] then {
> set LDFLAGS {}
> }
>
>+if { ![info exists DT_RELR_LDFLAGS] } then {
>+ set DT_RELR_LDFLAGS "-z pack-relative-relocs"
>+}
>+if { ![info exists DT_RELR_CC_LDFLAGS] } then {
>+ set DT_RELR_CC_LDFLAGS "-Wl,-z,pack-relative-relocs"
>+}
>+
GCC driver supports -z for a very long time (at least >=4.1.2),
so -Wl,-z, may be combined with the preceding -z.
>+if { ![info exists NO_DT_RELR_LDFLAGS] } then {
>+ set NO_DT_RELR_LDFLAGS "-z nopack-relative-relocs"
>+}
>+
>+if { ![info exists NO_DT_RELR_CC_LDFLAGS] } then {
>+ set NO_DT_RELR_CC_LDFLAGS "-Wl,-z,nopack-relative-relocs"
>+}
>+
> # Set LD_CLASS to "64bit" for a 64-bit *host* linker.
> if { ![info exists LD_CLASS] } then {
> set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]]
>diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
>index cb3b8c15cfc..1381544e6f8 100644
>--- a/ld/testsuite/ld-elf/shared.exp
>+++ b/ld/testsuite/ld-elf/shared.exp
>@@ -452,7 +452,8 @@ setup_xfail mips*-*-* bfin-*-*
> clear_xfail bfin-*-linux*
> run_ld_link_tests [list \
> [list "-Bsymbolic-functions" \
>- "-shared -Bsymbolic-functions" "" "$AFLAGS_PIC" \
>+ "-shared -Bsymbolic-functions $NO_DT_RELR_LDFLAGS" \
>+ "" "$AFLAGS_PIC" \
> {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}} \
> "symbolic-func.so"] \
> ]
>diff --git a/ld/testsuite/ld-i386/export-class.exp b/ld/testsuite/ld-i386/export-class.exp
>index 47b2c0f0056..04bc6a0d836 100644
>--- a/ld/testsuite/ld-i386/export-class.exp
>+++ b/ld/testsuite/ld-i386/export-class.exp
>@@ -74,7 +74,7 @@ run_ld_link_tests [list \
> run_ld_link_tests [list \
> [list \
> "$testname (final shared object)" \
>- "-shared -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
>+ "-shared $NO_DT_RELR_LDFLAGS -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
> "" \
> { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
> { \
>diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
>index 3ed6e42e78f..c2d8d8268c3 100644
>--- a/ld/testsuite/ld-i386/i386.exp
>+++ b/ld/testsuite/ld-i386/i386.exp
>@@ -177,12 +177,6 @@ set i386tests {
> {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
> {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
> "tlsbindesc"}
>- {"TLS -fno-pic -shared"
>- "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
>- -z noseparate-code --hash-style=sysv" ""
>- "--32" {tlsnopic1.s tlsnopic2.s}
>- {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
>- {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
> {"TLS with global dynamic and descriptors"
> "-shared -melf_i386 --no-ld-generated-unwind-info \
> -z noseparate-code --hash-style=sysv" ""
>@@ -293,6 +287,20 @@ iamcu_tests
>
> run_ld_link_tests $i386tests
>
>+run_ld_link_tests [list \
>+ [list \
>+ "TLS -fno-pic -shared" \
>+ "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
>+ -z noseparate-code --hash-style=sysv $NO_DT_RELR_LDFLAGS" \
>+ "" "--32" \
>+ {tlsnopic1.s tlsnopic2.s} \
>+ {{readelf -Ssrl tlsnopic.rd} \
>+ {objdump -drj.text tlsnopic.dd} \
>+ {objdump -sj.got tlsnopic.sd}} \
>+ "libtlsnopic.so" \
>+ ] \
>+]
>+
> run_dump_test "abs"
> run_dump_test "pcrel8"
> run_dump_test "pcrel16"
>diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d
>index 42aa2ce7410..98b6fb9a5aa 100644
>--- a/ld/testsuite/ld-i386/ibt-plt-2a.d
>+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-2.s
> #as: --32
>-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
>+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d
>index b357a74a33b..91f2023db35 100644
>--- a/ld/testsuite/ld-i386/ibt-plt-3a.d
>+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-3.s
> #as: --32
>-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
>+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d
>index b357a74a33b..91f2023db35 100644
>--- a/ld/testsuite/ld-i386/ibt-plt-3c.d
>+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-3.s
> #as: --32
>-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
>+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-i386/report-reloc-1.d b/ld/testsuite/ld-i386/report-reloc-1.d
>index 51fbbd8d105..162161592a1 100644
>--- a/ld/testsuite/ld-i386/report-reloc-1.d
>+++ b/ld/testsuite/ld-i386/report-reloc-1.d
>@@ -1,6 +1,6 @@
> #source: report-reloc-1.s
> #as: --32
>-#ld: -pie -melf_i386 -z report-relative-reloc
>+#ld: -pie -melf_i386 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> #warning_output: report-reloc-1.l
> #readelf: -r --wide
>
>diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
>index 0d3f7b80d06..aae24b2809d 100644
>--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
>+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
>@@ -1,5 +1,5 @@
> #source: ifunc-2-i386.s
>-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
>+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> #as: --32
> #objdump: -dw
> #target: x86_64-*-* i?86-*-*
>diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
>index 48d2084d38f..86083c12a08 100644
>--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
>+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
>@@ -1,5 +1,5 @@
> #source: ifunc-2-local-i386.s
>-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
>+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> #as: --32
> #objdump: -dw
> #target: x86_64-*-* i?86-*-*
>diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
>index 14866a8f6cc..be3da08e12b 100644
>--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
>+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
>@@ -1,6 +1,6 @@
> #source: ifunc-2-local-x86-64.s
> #as: --64
>-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
> #target: x86_64-*-*
>
>diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
>index 1cd60941ac0..b504f9adedd 100644
>--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
>+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
>@@ -1,6 +1,6 @@
> #source: ifunc-2-x86-64.s
> #as: --64
>-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
> #target: x86_64-*-*
>
>diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
>index 4cc1dc206d5..f6920272b63 100644
>--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
>+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
>@@ -1,6 +1,6 @@
> #source: pr17154-x86.s
> #as: --64
>-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
> #target: x86_64-*-*
>
>diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
>index 9fb23d410e3..90918426ee5 100644
>--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
>+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
>@@ -1,6 +1,6 @@
> #source: pr17154-x86.s
> #as: --64
>-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
> #target: x86_64-*-*
>
>diff --git a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
>index b7bc4e526cc..b1bcea3cf4c 100644
>--- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
>+++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
>@@ -1,6 +1,6 @@
> #source: bnd-branch-1.s -mx86-used-note=no
> #as: --64
>-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
>index 15ecfe1cc50..86ba30a46d5 100644
>--- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
>+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
>@@ -1,6 +1,6 @@
> #source: bnd-ifunc-1.s
> #as: --64 -madd-bnd-prefix -mx86-used-note=no
>-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
>index 211d72d2335..fa7ec07aaf0 100644
>--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
>+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
>@@ -1,6 +1,6 @@
> #source: bnd-ifunc-2.s
> #as: --64 -madd-bnd-prefix -mx86-used-note=no
>-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
>index f80ba15aa35..36534b14feb 100644
>--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
>+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
>@@ -1,5 +1,5 @@
> #as: --64 -madd-bnd-prefix -mx86-used-note=no
>-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> #...
>diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
>index 24e28210a0a..47289a04f43 100644
>--- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
>+++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
>@@ -1,6 +1,6 @@
> #source: bnd-branch-1.s
> #as: --64 -mx86-used-note=no
>-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1.d b/ld/testsuite/ld-x86-64/bnd-plt-1.d
>index 0df32555c18..f047da897ce 100644
>--- a/ld/testsuite/ld-x86-64/bnd-plt-1.d
>+++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d
>@@ -1,6 +1,6 @@
> #source: bnd-branch-1.s
> #as: --64 -mx86-used-note=no
>-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/export-class.exp b/ld/testsuite/ld-x86-64/export-class.exp
>index 26896d1ca87..14c2d240fac 100644
>--- a/ld/testsuite/ld-x86-64/export-class.exp
>+++ b/ld/testsuite/ld-x86-64/export-class.exp
>@@ -31,6 +31,7 @@ if { ![istarget x86_64*-*-linux*] } {
> }
>
> proc x86_64_export_class_test { abi flag emul } {
>+ global NO_DT_RELR_LDFLAGS
>
> set testname "x86-64 $abi symbol export class test"
>
>@@ -75,7 +76,7 @@ proc x86_64_export_class_test { abi flag emul } {
> run_ld_link_tests [list \
> [list \
> "$testname (final shared object)" \
>- "$LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
>+ "$LDFLAGS $NO_DT_RELR_LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
> "$AFLAGS" \
> { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
> [list \
>diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
>index a19cece98e8..23e31e62f55 100644
>--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
>+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-2.s
> #as: --x32
>-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
>index 92785929092..adbbf62e84d 100644
>--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
>+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-2.s
> #as: --64 -defsym __64_bit__=1
>-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
>index d6f8bb3afbe..f52b1cc796f 100644
>--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
>+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-3.s
> #as: --x32
>-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
>index 9c15ed4f928..8bd8851ea73 100644
>--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
>+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
>@@ -1,6 +1,6 @@
> #source: ibt-plt-3.s
> #as: --64 -defsym __64_bit__=1
>-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/ilp32-4.d b/ld/testsuite/ld-x86-64/ilp32-4.d
>index 34be012056e..ad5c9cdf858 100644
>--- a/ld/testsuite/ld-x86-64/ilp32-4.d
>+++ b/ld/testsuite/ld-x86-64/ilp32-4.d
>@@ -1,5 +1,5 @@
> #as: --x32
>-#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv
>+#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv $NO_DT_RELR_LDFLAGS
> #readelf: -d -S --wide
> #target: x86_64-*-linux*
>
>diff --git a/ld/testsuite/ld-x86-64/load1c.d b/ld/testsuite/ld-x86-64/load1c.d
>index db9c69fadbf..7404c7093b4 100644
>--- a/ld/testsuite/ld-x86-64/load1c.d
>+++ b/ld/testsuite/ld-x86-64/load1c.d
>@@ -1,6 +1,6 @@
> #source: load1.s
> #as: --64
>-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/load1d.d b/ld/testsuite/ld-x86-64/load1d.d
>index 7ccae532f27..1b474a375c7 100644
>--- a/ld/testsuite/ld-x86-64/load1d.d
>+++ b/ld/testsuite/ld-x86-64/load1d.d
>@@ -1,6 +1,6 @@
> #source: load1.s
> #as: --x32
>-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/pr13082-2b.d b/ld/testsuite/ld-x86-64/pr13082-2b.d
>index c218eafe34c..71c44fc0ee5 100644
>--- a/ld/testsuite/ld-x86-64/pr13082-2b.d
>+++ b/ld/testsuite/ld-x86-64/pr13082-2b.d
>@@ -1,7 +1,7 @@
> #source: pr13082-2.s
> #name: PR ld/13082-2 (b)
> #as: --x32
>-#ld: -pie -melf32_x86_64
>+#ld: -pie -melf32_x86_64 $NO_DT_RELR_LDFLAGS
> #readelf: -r --wide
>
> Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
>diff --git a/ld/testsuite/ld-x86-64/pr14207.d b/ld/testsuite/ld-x86-64/pr14207.d
>index f330600b916..e3af36146c6 100644
>--- a/ld/testsuite/ld-x86-64/pr14207.d
>+++ b/ld/testsuite/ld-x86-64/pr14207.d
>@@ -1,6 +1,6 @@
> #name: PR ld/14207
> #as: --64
>-#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #readelf: -l --wide
> #target: x86_64-*-linux*
>
>diff --git a/ld/testsuite/ld-x86-64/pr18176.d b/ld/testsuite/ld-x86-64/pr18176.d
>index 4e3ad9ff08d..a99ff15ac6b 100644
>--- a/ld/testsuite/ld-x86-64/pr18176.d
>+++ b/ld/testsuite/ld-x86-64/pr18176.d
>@@ -1,6 +1,6 @@
> #name: PR ld/18176
> #as: --64
>-#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000
>+#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000 $NO_DT_RELR_LDFLAGS
> #readelf: -l --wide
> #target: x86_64-*-linux*
>
>diff --git a/ld/testsuite/ld-x86-64/pr19162.d b/ld/testsuite/ld-x86-64/pr19162.d
>index 2d51dabe729..f458853d8e5 100644
>--- a/ld/testsuite/ld-x86-64/pr19162.d
>+++ b/ld/testsuite/ld-x86-64/pr19162.d
>@@ -1,7 +1,7 @@
> #source: pr19162a.s
> #source: pr19162b.s
> #as: --64
>-#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv
>+#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv $NO_DT_RELR_LDFLAGS
> #readelf: -l --wide
> #target: x86_64-*-linux*
>
>diff --git a/ld/testsuite/ld-x86-64/pr19636-2d.d b/ld/testsuite/ld-x86-64/pr19636-2d.d
>index 3bd33a9a915..092992be9d4 100644
>--- a/ld/testsuite/ld-x86-64/pr19636-2d.d
>+++ b/ld/testsuite/ld-x86-64/pr19636-2d.d
>@@ -1,6 +1,6 @@
> #source: pr19636-2.s
> #as: --64 -mrelax-relocations=no
>-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/pr19636-2l.d b/ld/testsuite/ld-x86-64/pr19636-2l.d
>index 1b894b3e97c..8c23c0b7411 100644
>--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
>+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
>@@ -1,6 +1,6 @@
> #source: pr19636-2.s
> #as: --64 -mrelax-relocations=no
>-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code
>+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
> #warning: -z dynamic-undefined-weak ignored
>
>diff --git a/ld/testsuite/ld-x86-64/pr20253-1d.d b/ld/testsuite/ld-x86-64/pr20253-1d.d
>index f9f03ba8403..057577bdc57 100644
>--- a/ld/testsuite/ld-x86-64/pr20253-1d.d
>+++ b/ld/testsuite/ld-x86-64/pr20253-1d.d
>@@ -1,6 +1,6 @@
> #source: pr20253-1.s
> #as: --64
>-#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/pr20253-1f.d b/ld/testsuite/ld-x86-64/pr20253-1f.d
>index 6666bcaf147..479db8202e8 100644
>--- a/ld/testsuite/ld-x86-64/pr20253-1f.d
>+++ b/ld/testsuite/ld-x86-64/pr20253-1f.d
>@@ -1,6 +1,6 @@
> #source: pr20253-1.s
> #as: --64
>-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/pr20253-1j.d b/ld/testsuite/ld-x86-64/pr20253-1j.d
>index 88c9715ad75..20176a2d357 100644
>--- a/ld/testsuite/ld-x86-64/pr20253-1j.d
>+++ b/ld/testsuite/ld-x86-64/pr20253-1j.d
>@@ -1,6 +1,6 @@
> #source: pr20253-1.s
> #as: --x32
>-#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/pr20253-1l.d b/ld/testsuite/ld-x86-64/pr20253-1l.d
>index 7428a721b16..4b179077dec 100644
>--- a/ld/testsuite/ld-x86-64/pr20253-1l.d
>+++ b/ld/testsuite/ld-x86-64/pr20253-1l.d
>@@ -1,6 +1,6 @@
> #source: pr20253-1.s
> #as: --x32
>-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
>+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> #objdump: -dw
>
> .*: +file format .*
>diff --git a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
>index c66f956c473..63fe7b1bb8a 100644
>--- a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
>+++ b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
>@@ -1,6 +1,6 @@
> #source: report-reloc-1.s
> #as: --x32
>-#ld: -pie -melf32_x86_64 -z report-relative-reloc
>+#ld: -pie -melf32_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> #warning_output: report-reloc-1.l
> #readelf: -r --wide
>
>diff --git a/ld/testsuite/ld-x86-64/report-reloc-1.d b/ld/testsuite/ld-x86-64/report-reloc-1.d
>index 1b5f91fdd3f..69f164c9434 100644
>--- a/ld/testsuite/ld-x86-64/report-reloc-1.d
>+++ b/ld/testsuite/ld-x86-64/report-reloc-1.d
>@@ -1,6 +1,6 @@
> #source: report-reloc-1.s
> #as: --64
>-#ld: -pie -melf_x86_64 -z report-relative-reloc
>+#ld: -pie -melf_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> #warning_output: report-reloc-1.l
> #readelf: -r --wide
>
>diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
>index c100879397e..b4048128057 100644
>--- a/ld/testsuite/ld-x86-64/x86-64.exp
>+++ b/ld/testsuite/ld-x86-64/x86-64.exp
>@@ -45,28 +45,6 @@ set x86_64tests {
> {"basic PLT generation"
> "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
> {{objdump -drj.plt plt.pd}} "plt"}
>- {"TLS -fpic -shared transitions"
>- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
>- "--64" {tlspic1.s tlspic2.s}
>- {{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd}
>- {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
>- "libtlspic.so"}
>- {"TLS -fpic -shared transitions with r15 as GOT base"
>- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
>- "--64 -mrelax-relocations=yes"
>- {tlspic3.s tlspic2.s}
>- {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
>- {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
>- "libtlspic2.so"}
>- {"TLS descriptor -fpic -shared transitions"
>- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
>- "--64" {tlsdesc.s tlspic2.s}
>- {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
>- {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
>- {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
> {"Helper shared library" "-shared -melf_x86_64" ""
> "--64" {tlslib.s} {} "libtlslib.so"}
> {"TLS -fpic and -fno-pic exec transitions"
>@@ -240,6 +218,49 @@ set x86_64tests {
>
> run_ld_link_tests $x86_64tests
>
>+run_ld_link_tests [list \
>+ [list \
>+ "TLS -fpic -shared transitions" \
>+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
>+ $NO_DT_RELR_LDFLAGS" \
>+ "" "--64" \
>+ {tlspic1.s tlspic2.s} \
>+ {{readelf -WSsrl tlspic.rd} \
>+ {objdump {-drj.text -Mintel64} tlspic.dd} \
>+ {objdump -sj.got tlspic.sd} \
>+ {objdump -sj.tdata tlspic.td}} \
>+ "libtlspic.so" \
>+ ] \
>+ [list \
>+ "TLS -fpic -shared transitions with r15 as GOT base" \
>+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
>+ $NO_DT_RELR_LDFLAGS" \
>+ "" "--64 -mrelax-relocations=yes" \
>+ {tlspic3.s tlspic2.s} \
>+ {{readelf -WSsrl tlspic2.rd} \
>+ {objdump {-drj.text -Mintel64} tlspic2.dd} \
>+ {objdump -sj.got tlspic2.sd} \
>+ {objdump -sj.tdata tlspic2.td}} \
>+ "libtlspic2.so" \
>+ ] \
>+ [list \
>+ "TLS descriptor -fpic -shared transitions" \
>+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
>+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
>+ $NO_DT_RELR_LDFLAGS" \
>+ "" "--64" \
>+ {tlsdesc.s tlspic2.s} \
>+ {{readelf -WSsrld tlsdesc.rd} \
>+ {objdump -drj.text tlsdesc.dd} \
>+ {objdump {-s -j.got -j.got.plt} tlsdesc.sd} \
>+ {objdump -sj.tdata tlsdesc.td} \
>+ {objdump -drj.plt tlsdesc.pd}} \
>+ "libtlsdesc.so" \
>+ ] \
>+]
>+
> set test_name "Mixed x86_64 and i386 input test 1"
> set test mixed1
> if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {
>--
>2.33.1
>
On Fri, Jan 7, 2022 at 6:42 PM Fangrui Song <i@maskray.me> wrote:
>
>
> On 2022-01-07, H.J. Lu via Binutils wrote:
> >Allow eabling and disabling DT_RELR in linker tests. Disable DT_RELR in
> >linker tests which don't expect DT_RELR in linker outputs.
> >
> >binutils/
> >
> > * testsuite/lib/binutils-common.exp (run_dump_test): Make
> > DT_RELR_LDFLAGS and NO_DT_RELR_LDFLAGS global.
> >
> >ld/
> >
> > * testsuite/config/default.exp (DT_RELR_LDFLAGS): New.
> > (DT_RELR_CC_LDFLAGS): Likewise.
> > (NO_DT_RELR_LDFLAGS): Likewise.
> > (NO_DT_RELR_CC_LDFLAGS): Likewise.
> > * testsuite/ld-elf/shared.exp: Pass $NO_DT_RELR_LDFLAGS to
> > linker for some tests.
> > * testsuite/ld-i386/export-class.exp: Likewise.
> > * testsuite/ld-i386/i386.exp: Likewise.
> > * testsuite/ld-i386/ibt-plt-2a.d: Pass $NO_DT_RELR_LDFLAGS to
> > linker.
> > * testsuite/ld-i386/ibt-plt-3a.d: Likewise.
> > * testsuite/ld-i386/ibt-plt-3c.d: Likewise.
> > * testsuite/ld-i386/report-reloc-1.d: Likewise.
> > * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
> > * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
> > * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
> > * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
> > * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
> > * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
> > * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
> > * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
> > * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
> > * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
> > * testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
> > * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
> > * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
> > * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
> > * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
> > * testsuite/ld-x86-64/ilp32-4.d: Likewise.
> > * testsuite/ld-x86-64/load1c.d: Likewise.
> > * testsuite/ld-x86-64/load1d.d: Likewise.
> > * testsuite/ld-x86-64/pr13082-2b.d: Likewise.
> > * testsuite/ld-x86-64/pr14207.d: Likewise.
> > * testsuite/ld-x86-64/pr18176.d: Likewise.
> > * testsuite/ld-x86-64/pr19162.d: Likewise.
> > * testsuite/ld-x86-64/pr19636-2d.d: Likewise.
> > * testsuite/ld-x86-64/pr19636-2l.d: Likewise.
> > * testsuite/ld-x86-64/pr20253-1d.d: Likewise.
> > * testsuite/ld-x86-64/pr20253-1f.d: Likewise.
> > * testsuite/ld-x86-64/pr20253-1j.d: Likewise.
> > * testsuite/ld-x86-64/pr20253-1l.d: Likewise.
> > * testsuite/ld-x86-64/report-reloc-1-x32.d: Likewise.
> > * testsuite/ld-x86-64/report-reloc-1.d: Likewise.
> > * testsuite/ld-x86-64/export-class.exp (x86_64_export_class_test):
> > Pass $NO_DT_RELR_LDFLAGS to linker.
> > * testsuite/ld-x86-64/x86-64.exp: Pass $NO_DT_RELR_LDFLAGS to
> > linker for some tests.
> >---
> > binutils/testsuite/lib/binutils-common.exp | 1 +
> > ld/testsuite/config/default.exp | 16 +++++
> > ld/testsuite/ld-elf/shared.exp | 3 +-
> > ld/testsuite/ld-i386/export-class.exp | 2 +-
> > ld/testsuite/ld-i386/i386.exp | 20 ++++--
> > ld/testsuite/ld-i386/ibt-plt-2a.d | 2 +-
> > ld/testsuite/ld-i386/ibt-plt-3a.d | 2 +-
> > ld/testsuite/ld-i386/ibt-plt-3c.d | 2 +-
> > ld/testsuite/ld-i386/report-reloc-1.d | 2 +-
> > ld/testsuite/ld-ifunc/ifunc-2-i386-now.d | 2 +-
> > .../ld-ifunc/ifunc-2-local-i386-now.d | 2 +-
> > .../ld-ifunc/ifunc-2-local-x86-64-now.d | 2 +-
> > ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d | 2 +-
> > ld/testsuite/ld-ifunc/pr17154-x86-64-now.d | 2 +-
> > ld/testsuite/ld-ifunc/pr17154-x86-64.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-branch-1-now.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-ifunc-2.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-plt-1-now.d | 2 +-
> > ld/testsuite/ld-x86-64/bnd-plt-1.d | 2 +-
> > ld/testsuite/ld-x86-64/export-class.exp | 3 +-
> > ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d | 2 +-
> > ld/testsuite/ld-x86-64/ibt-plt-2a.d | 2 +-
> > ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d | 2 +-
> > ld/testsuite/ld-x86-64/ibt-plt-3a.d | 2 +-
> > ld/testsuite/ld-x86-64/ilp32-4.d | 2 +-
> > ld/testsuite/ld-x86-64/load1c.d | 2 +-
> > ld/testsuite/ld-x86-64/load1d.d | 2 +-
> > ld/testsuite/ld-x86-64/pr13082-2b.d | 2 +-
> > ld/testsuite/ld-x86-64/pr14207.d | 2 +-
> > ld/testsuite/ld-x86-64/pr18176.d | 2 +-
> > ld/testsuite/ld-x86-64/pr19162.d | 2 +-
> > ld/testsuite/ld-x86-64/pr19636-2d.d | 2 +-
> > ld/testsuite/ld-x86-64/pr19636-2l.d | 2 +-
> > ld/testsuite/ld-x86-64/pr20253-1d.d | 2 +-
> > ld/testsuite/ld-x86-64/pr20253-1f.d | 2 +-
> > ld/testsuite/ld-x86-64/pr20253-1j.d | 2 +-
> > ld/testsuite/ld-x86-64/pr20253-1l.d | 2 +-
> > ld/testsuite/ld-x86-64/report-reloc-1-x32.d | 2 +-
> > ld/testsuite/ld-x86-64/report-reloc-1.d | 2 +-
> > ld/testsuite/ld-x86-64/x86-64.exp | 65 ++++++++++++-------
> > 42 files changed, 114 insertions(+), 66 deletions(-)
> >
> >diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
> >index 0e0ba8e5aee..88fdc1a71c7 100644
> >--- a/binutils/testsuite/lib/binutils-common.exp
> >+++ b/binutils/testsuite/lib/binutils-common.exp
> >@@ -855,6 +855,7 @@ proc run_dump_test { name {extra_options {}} } {
> > global ELFEDIT ELFEDITFLAGS LD LDFLAGS NM NMFLAGS OBJCOPY OBJCOPYFLAGS
> > global OBJDUMP OBJDUMPFLAGS READELF READELFFLAGS STRIP STRIPFLAGS
> > global copyfile env runtests srcdir subdir verbose
> >+ global DT_RELR_LDFLAGS NO_DT_RELR_LDFLAGS
> >
> > if [string match "*/*" $name] {
> > set file $name
> >diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
> >index c988d5d2924..52e75048ede 100644
> >--- a/ld/testsuite/config/default.exp
> >+++ b/ld/testsuite/config/default.exp
> >@@ -313,6 +313,22 @@ if ![info exists LDFLAGS] then {
> > set LDFLAGS {}
> > }
> >
> >+if { ![info exists DT_RELR_LDFLAGS] } then {
> >+ set DT_RELR_LDFLAGS "-z pack-relative-relocs"
> >+}
>
> >+if { ![info exists DT_RELR_CC_LDFLAGS] } then {
> >+ set DT_RELR_CC_LDFLAGS "-Wl,-z,pack-relative-relocs"
> >+}
> >+
>
> GCC driver supports -z for a very long time (at least >=4.1.2),
> so -Wl,-z, may be combined with the preceding -z.
This won't hurt and is more flexible.
> >+if { ![info exists NO_DT_RELR_LDFLAGS] } then {
> >+ set NO_DT_RELR_LDFLAGS "-z nopack-relative-relocs"
> >+}
> >+
> >+if { ![info exists NO_DT_RELR_CC_LDFLAGS] } then {
> >+ set NO_DT_RELR_CC_LDFLAGS "-Wl,-z,nopack-relative-relocs"
> >+}
> >+
> > # Set LD_CLASS to "64bit" for a 64-bit *host* linker.
> > if { ![info exists LD_CLASS] } then {
> > set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]]
> >diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
> >index cb3b8c15cfc..1381544e6f8 100644
> >--- a/ld/testsuite/ld-elf/shared.exp
> >+++ b/ld/testsuite/ld-elf/shared.exp
> >@@ -452,7 +452,8 @@ setup_xfail mips*-*-* bfin-*-*
> > clear_xfail bfin-*-linux*
> > run_ld_link_tests [list \
> > [list "-Bsymbolic-functions" \
> >- "-shared -Bsymbolic-functions" "" "$AFLAGS_PIC" \
> >+ "-shared -Bsymbolic-functions $NO_DT_RELR_LDFLAGS" \
> >+ "" "$AFLAGS_PIC" \
> > {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}} \
> > "symbolic-func.so"] \
> > ]
> >diff --git a/ld/testsuite/ld-i386/export-class.exp b/ld/testsuite/ld-i386/export-class.exp
> >index 47b2c0f0056..04bc6a0d836 100644
> >--- a/ld/testsuite/ld-i386/export-class.exp
> >+++ b/ld/testsuite/ld-i386/export-class.exp
> >@@ -74,7 +74,7 @@ run_ld_link_tests [list \
> > run_ld_link_tests [list \
> > [list \
> > "$testname (final shared object)" \
> >- "-shared -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
> >+ "-shared $NO_DT_RELR_LDFLAGS -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
> > "" \
> > { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
> > { \
> >diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
> >index 3ed6e42e78f..c2d8d8268c3 100644
> >--- a/ld/testsuite/ld-i386/i386.exp
> >+++ b/ld/testsuite/ld-i386/i386.exp
> >@@ -177,12 +177,6 @@ set i386tests {
> > {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
> > {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
> > "tlsbindesc"}
> >- {"TLS -fno-pic -shared"
> >- "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
> >- -z noseparate-code --hash-style=sysv" ""
> >- "--32" {tlsnopic1.s tlsnopic2.s}
> >- {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
> >- {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
> > {"TLS with global dynamic and descriptors"
> > "-shared -melf_i386 --no-ld-generated-unwind-info \
> > -z noseparate-code --hash-style=sysv" ""
> >@@ -293,6 +287,20 @@ iamcu_tests
> >
> > run_ld_link_tests $i386tests
> >
> >+run_ld_link_tests [list \
> >+ [list \
> >+ "TLS -fno-pic -shared" \
> >+ "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
> >+ -z noseparate-code --hash-style=sysv $NO_DT_RELR_LDFLAGS" \
> >+ "" "--32" \
> >+ {tlsnopic1.s tlsnopic2.s} \
> >+ {{readelf -Ssrl tlsnopic.rd} \
> >+ {objdump -drj.text tlsnopic.dd} \
> >+ {objdump -sj.got tlsnopic.sd}} \
> >+ "libtlsnopic.so" \
> >+ ] \
> >+]
> >+
> > run_dump_test "abs"
> > run_dump_test "pcrel8"
> > run_dump_test "pcrel16"
> >diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d
> >index 42aa2ce7410..98b6fb9a5aa 100644
> >--- a/ld/testsuite/ld-i386/ibt-plt-2a.d
> >+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-2.s
> > #as: --32
> >-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
> >+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d
> >index b357a74a33b..91f2023db35 100644
> >--- a/ld/testsuite/ld-i386/ibt-plt-3a.d
> >+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-3.s
> > #as: --32
> >-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
> >+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d
> >index b357a74a33b..91f2023db35 100644
> >--- a/ld/testsuite/ld-i386/ibt-plt-3c.d
> >+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-3.s
> > #as: --32
> >-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
> >+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-i386/report-reloc-1.d b/ld/testsuite/ld-i386/report-reloc-1.d
> >index 51fbbd8d105..162161592a1 100644
> >--- a/ld/testsuite/ld-i386/report-reloc-1.d
> >+++ b/ld/testsuite/ld-i386/report-reloc-1.d
> >@@ -1,6 +1,6 @@
> > #source: report-reloc-1.s
> > #as: --32
> >-#ld: -pie -melf_i386 -z report-relative-reloc
> >+#ld: -pie -melf_i386 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> > #warning_output: report-reloc-1.l
> > #readelf: -r --wide
> >
> >diff --git a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
> >index 0d3f7b80d06..aae24b2809d 100644
> >--- a/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
> >+++ b/ld/testsuite/ld-ifunc/ifunc-2-i386-now.d
> >@@ -1,5 +1,5 @@
> > #source: ifunc-2-i386.s
> >-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
> >+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #as: --32
> > #objdump: -dw
> > #target: x86_64-*-* i?86-*-*
> >diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
> >index 48d2084d38f..86083c12a08 100644
> >--- a/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
> >+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-i386-now.d
> >@@ -1,5 +1,5 @@
> > #source: ifunc-2-local-i386.s
> >-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
> >+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #as: --32
> > #objdump: -dw
> > #target: x86_64-*-* i?86-*-*
> >diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> >index 14866a8f6cc..be3da08e12b 100644
> >--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> >+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> >@@ -1,6 +1,6 @@
> > #source: ifunc-2-local-x86-64.s
> > #as: --64
> >-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> > #target: x86_64-*-*
> >
> >diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> >index 1cd60941ac0..b504f9adedd 100644
> >--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> >+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> >@@ -1,6 +1,6 @@
> > #source: ifunc-2-x86-64.s
> > #as: --64
> >-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> > #target: x86_64-*-*
> >
> >diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> >index 4cc1dc206d5..f6920272b63 100644
> >--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> >+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> >@@ -1,6 +1,6 @@
> > #source: pr17154-x86.s
> > #as: --64
> >-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> > #target: x86_64-*-*
> >
> >diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> >index 9fb23d410e3..90918426ee5 100644
> >--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> >+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> >@@ -1,6 +1,6 @@
> > #source: pr17154-x86.s
> > #as: --64
> >-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> > #target: x86_64-*-*
> >
> >diff --git a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
> >index b7bc4e526cc..b1bcea3cf4c 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d
> >@@ -1,6 +1,6 @@
> > #source: bnd-branch-1.s -mx86-used-note=no
> > #as: --64
> >-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
> >index 15ecfe1cc50..86ba30a46d5 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-1-now.d
> >@@ -1,6 +1,6 @@
> > #source: bnd-ifunc-1.s
> > #as: --64 -madd-bnd-prefix -mx86-used-note=no
> >-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
> >index 211d72d2335..fa7ec07aaf0 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d
> >@@ -1,6 +1,6 @@
> > #source: bnd-ifunc-2.s
> > #as: --64 -madd-bnd-prefix -mx86-used-note=no
> >-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
> >index f80ba15aa35..36534b14feb 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2.d
> >@@ -1,5 +1,5 @@
> > #as: --64 -madd-bnd-prefix -mx86-used-note=no
> >-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > #...
> >diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
> >index 24e28210a0a..47289a04f43 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d
> >@@ -1,6 +1,6 @@
> > #source: bnd-branch-1.s
> > #as: --64 -mx86-used-note=no
> >-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1.d b/ld/testsuite/ld-x86-64/bnd-plt-1.d
> >index 0df32555c18..f047da897ce 100644
> >--- a/ld/testsuite/ld-x86-64/bnd-plt-1.d
> >+++ b/ld/testsuite/ld-x86-64/bnd-plt-1.d
> >@@ -1,6 +1,6 @@
> > #source: bnd-branch-1.s
> > #as: --64 -mx86-used-note=no
> >-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/export-class.exp b/ld/testsuite/ld-x86-64/export-class.exp
> >index 26896d1ca87..14c2d240fac 100644
> >--- a/ld/testsuite/ld-x86-64/export-class.exp
> >+++ b/ld/testsuite/ld-x86-64/export-class.exp
> >@@ -31,6 +31,7 @@ if { ![istarget x86_64*-*-linux*] } {
> > }
> >
> > proc x86_64_export_class_test { abi flag emul } {
> >+ global NO_DT_RELR_LDFLAGS
> >
> > set testname "x86-64 $abi symbol export class test"
> >
> >@@ -75,7 +76,7 @@ proc x86_64_export_class_test { abi flag emul } {
> > run_ld_link_tests [list \
> > [list \
> > "$testname (final shared object)" \
> >- "$LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
> >+ "$LDFLAGS $NO_DT_RELR_LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
> > "$AFLAGS" \
> > { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
> > [list \
> >diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
> >index a19cece98e8..23e31e62f55 100644
> >--- a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
> >+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-2.s
> > #as: --x32
> >-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
> >index 92785929092..adbbf62e84d 100644
> >--- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d
> >+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-2.s
> > #as: --64 -defsym __64_bit__=1
> >-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
> >index d6f8bb3afbe..f52b1cc796f 100644
> >--- a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
> >+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-3.s
> > #as: --x32
> >-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
> >index 9c15ed4f928..8bd8851ea73 100644
> >--- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d
> >+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
> >@@ -1,6 +1,6 @@
> > #source: ibt-plt-3.s
> > #as: --64 -defsym __64_bit__=1
> >-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/ilp32-4.d b/ld/testsuite/ld-x86-64/ilp32-4.d
> >index 34be012056e..ad5c9cdf858 100644
> >--- a/ld/testsuite/ld-x86-64/ilp32-4.d
> >+++ b/ld/testsuite/ld-x86-64/ilp32-4.d
> >@@ -1,5 +1,5 @@
> > #as: --x32
> >-#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv
> >+#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv $NO_DT_RELR_LDFLAGS
> > #readelf: -d -S --wide
> > #target: x86_64-*-linux*
> >
> >diff --git a/ld/testsuite/ld-x86-64/load1c.d b/ld/testsuite/ld-x86-64/load1c.d
> >index db9c69fadbf..7404c7093b4 100644
> >--- a/ld/testsuite/ld-x86-64/load1c.d
> >+++ b/ld/testsuite/ld-x86-64/load1c.d
> >@@ -1,6 +1,6 @@
> > #source: load1.s
> > #as: --64
> >-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/load1d.d b/ld/testsuite/ld-x86-64/load1d.d
> >index 7ccae532f27..1b474a375c7 100644
> >--- a/ld/testsuite/ld-x86-64/load1d.d
> >+++ b/ld/testsuite/ld-x86-64/load1d.d
> >@@ -1,6 +1,6 @@
> > #source: load1.s
> > #as: --x32
> >-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/pr13082-2b.d b/ld/testsuite/ld-x86-64/pr13082-2b.d
> >index c218eafe34c..71c44fc0ee5 100644
> >--- a/ld/testsuite/ld-x86-64/pr13082-2b.d
> >+++ b/ld/testsuite/ld-x86-64/pr13082-2b.d
> >@@ -1,7 +1,7 @@
> > #source: pr13082-2.s
> > #name: PR ld/13082-2 (b)
> > #as: --x32
> >-#ld: -pie -melf32_x86_64
> >+#ld: -pie -melf32_x86_64 $NO_DT_RELR_LDFLAGS
> > #readelf: -r --wide
> >
> > Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
> >diff --git a/ld/testsuite/ld-x86-64/pr14207.d b/ld/testsuite/ld-x86-64/pr14207.d
> >index f330600b916..e3af36146c6 100644
> >--- a/ld/testsuite/ld-x86-64/pr14207.d
> >+++ b/ld/testsuite/ld-x86-64/pr14207.d
> >@@ -1,6 +1,6 @@
> > #name: PR ld/14207
> > #as: --64
> >-#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #readelf: -l --wide
> > #target: x86_64-*-linux*
> >
> >diff --git a/ld/testsuite/ld-x86-64/pr18176.d b/ld/testsuite/ld-x86-64/pr18176.d
> >index 4e3ad9ff08d..a99ff15ac6b 100644
> >--- a/ld/testsuite/ld-x86-64/pr18176.d
> >+++ b/ld/testsuite/ld-x86-64/pr18176.d
> >@@ -1,6 +1,6 @@
> > #name: PR ld/18176
> > #as: --64
> >-#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000
> >+#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000 $NO_DT_RELR_LDFLAGS
> > #readelf: -l --wide
> > #target: x86_64-*-linux*
> >
> >diff --git a/ld/testsuite/ld-x86-64/pr19162.d b/ld/testsuite/ld-x86-64/pr19162.d
> >index 2d51dabe729..f458853d8e5 100644
> >--- a/ld/testsuite/ld-x86-64/pr19162.d
> >+++ b/ld/testsuite/ld-x86-64/pr19162.d
> >@@ -1,7 +1,7 @@
> > #source: pr19162a.s
> > #source: pr19162b.s
> > #as: --64
> >-#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv
> >+#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv $NO_DT_RELR_LDFLAGS
> > #readelf: -l --wide
> > #target: x86_64-*-linux*
> >
> >diff --git a/ld/testsuite/ld-x86-64/pr19636-2d.d b/ld/testsuite/ld-x86-64/pr19636-2d.d
> >index 3bd33a9a915..092992be9d4 100644
> >--- a/ld/testsuite/ld-x86-64/pr19636-2d.d
> >+++ b/ld/testsuite/ld-x86-64/pr19636-2d.d
> >@@ -1,6 +1,6 @@
> > #source: pr19636-2.s
> > #as: --64 -mrelax-relocations=no
> >-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/pr19636-2l.d b/ld/testsuite/ld-x86-64/pr19636-2l.d
> >index 1b894b3e97c..8c23c0b7411 100644
> >--- a/ld/testsuite/ld-x86-64/pr19636-2l.d
> >+++ b/ld/testsuite/ld-x86-64/pr19636-2l.d
> >@@ -1,6 +1,6 @@
> > #source: pr19636-2.s
> > #as: --64 -mrelax-relocations=no
> >-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> > #warning: -z dynamic-undefined-weak ignored
> >
> >diff --git a/ld/testsuite/ld-x86-64/pr20253-1d.d b/ld/testsuite/ld-x86-64/pr20253-1d.d
> >index f9f03ba8403..057577bdc57 100644
> >--- a/ld/testsuite/ld-x86-64/pr20253-1d.d
> >+++ b/ld/testsuite/ld-x86-64/pr20253-1d.d
> >@@ -1,6 +1,6 @@
> > #source: pr20253-1.s
> > #as: --64
> >-#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/pr20253-1f.d b/ld/testsuite/ld-x86-64/pr20253-1f.d
> >index 6666bcaf147..479db8202e8 100644
> >--- a/ld/testsuite/ld-x86-64/pr20253-1f.d
> >+++ b/ld/testsuite/ld-x86-64/pr20253-1f.d
> >@@ -1,6 +1,6 @@
> > #source: pr20253-1.s
> > #as: --64
> >-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/pr20253-1j.d b/ld/testsuite/ld-x86-64/pr20253-1j.d
> >index 88c9715ad75..20176a2d357 100644
> >--- a/ld/testsuite/ld-x86-64/pr20253-1j.d
> >+++ b/ld/testsuite/ld-x86-64/pr20253-1j.d
> >@@ -1,6 +1,6 @@
> > #source: pr20253-1.s
> > #as: --x32
> >-#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/pr20253-1l.d b/ld/testsuite/ld-x86-64/pr20253-1l.d
> >index 7428a721b16..4b179077dec 100644
> >--- a/ld/testsuite/ld-x86-64/pr20253-1l.d
> >+++ b/ld/testsuite/ld-x86-64/pr20253-1l.d
> >@@ -1,6 +1,6 @@
> > #source: pr20253-1.s
> > #as: --x32
> >-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> >+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> > #objdump: -dw
> >
> > .*: +file format .*
> >diff --git a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
> >index c66f956c473..63fe7b1bb8a 100644
> >--- a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
> >+++ b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
> >@@ -1,6 +1,6 @@
> > #source: report-reloc-1.s
> > #as: --x32
> >-#ld: -pie -melf32_x86_64 -z report-relative-reloc
> >+#ld: -pie -melf32_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> > #warning_output: report-reloc-1.l
> > #readelf: -r --wide
> >
> >diff --git a/ld/testsuite/ld-x86-64/report-reloc-1.d b/ld/testsuite/ld-x86-64/report-reloc-1.d
> >index 1b5f91fdd3f..69f164c9434 100644
> >--- a/ld/testsuite/ld-x86-64/report-reloc-1.d
> >+++ b/ld/testsuite/ld-x86-64/report-reloc-1.d
> >@@ -1,6 +1,6 @@
> > #source: report-reloc-1.s
> > #as: --64
> >-#ld: -pie -melf_x86_64 -z report-relative-reloc
> >+#ld: -pie -melf_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
> > #warning_output: report-reloc-1.l
> > #readelf: -r --wide
> >
> >diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
> >index c100879397e..b4048128057 100644
> >--- a/ld/testsuite/ld-x86-64/x86-64.exp
> >+++ b/ld/testsuite/ld-x86-64/x86-64.exp
> >@@ -45,28 +45,6 @@ set x86_64tests {
> > {"basic PLT generation"
> > "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
> > {{objdump -drj.plt plt.pd}} "plt"}
> >- {"TLS -fpic -shared transitions"
> >- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
> >- "--64" {tlspic1.s tlspic2.s}
> >- {{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd}
> >- {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
> >- "libtlspic.so"}
> >- {"TLS -fpic -shared transitions with r15 as GOT base"
> >- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
> >- "--64 -mrelax-relocations=yes"
> >- {tlspic3.s tlspic2.s}
> >- {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
> >- {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
> >- "libtlspic2.so"}
> >- {"TLS descriptor -fpic -shared transitions"
> >- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
> >- "--64" {tlsdesc.s tlspic2.s}
> >- {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
> >- {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
> >- {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
> > {"Helper shared library" "-shared -melf_x86_64" ""
> > "--64" {tlslib.s} {} "libtlslib.so"}
> > {"TLS -fpic and -fno-pic exec transitions"
> >@@ -240,6 +218,49 @@ set x86_64tests {
> >
> > run_ld_link_tests $x86_64tests
> >
> >+run_ld_link_tests [list \
> >+ [list \
> >+ "TLS -fpic -shared transitions" \
> >+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
> >+ $NO_DT_RELR_LDFLAGS" \
> >+ "" "--64" \
> >+ {tlspic1.s tlspic2.s} \
> >+ {{readelf -WSsrl tlspic.rd} \
> >+ {objdump {-drj.text -Mintel64} tlspic.dd} \
> >+ {objdump -sj.got tlspic.sd} \
> >+ {objdump -sj.tdata tlspic.td}} \
> >+ "libtlspic.so" \
> >+ ] \
> >+ [list \
> >+ "TLS -fpic -shared transitions with r15 as GOT base" \
> >+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
> >+ $NO_DT_RELR_LDFLAGS" \
> >+ "" "--64 -mrelax-relocations=yes" \
> >+ {tlspic3.s tlspic2.s} \
> >+ {{readelf -WSsrl tlspic2.rd} \
> >+ {objdump {-drj.text -Mintel64} tlspic2.dd} \
> >+ {objdump -sj.got tlspic2.sd} \
> >+ {objdump -sj.tdata tlspic2.td}} \
> >+ "libtlspic2.so" \
> >+ ] \
> >+ [list \
> >+ "TLS descriptor -fpic -shared transitions" \
> >+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
> >+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
> >+ $NO_DT_RELR_LDFLAGS" \
> >+ "" "--64" \
> >+ {tlsdesc.s tlspic2.s} \
> >+ {{readelf -WSsrld tlsdesc.rd} \
> >+ {objdump -drj.text tlsdesc.dd} \
> >+ {objdump {-s -j.got -j.got.plt} tlsdesc.sd} \
> >+ {objdump -sj.tdata tlsdesc.td} \
> >+ {objdump -drj.plt tlsdesc.pd}} \
> >+ "libtlsdesc.so" \
> >+ ] \
> >+]
> >+
> > set test_name "Mixed x86_64 and i386 input test 1"
> > set test mixed1
> > if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {
> >--
> >2.33.1
> >
@@ -855,6 +855,7 @@ proc run_dump_test { name {extra_options {}} } {
global ELFEDIT ELFEDITFLAGS LD LDFLAGS NM NMFLAGS OBJCOPY OBJCOPYFLAGS
global OBJDUMP OBJDUMPFLAGS READELF READELFFLAGS STRIP STRIPFLAGS
global copyfile env runtests srcdir subdir verbose
+ global DT_RELR_LDFLAGS NO_DT_RELR_LDFLAGS
if [string match "*/*" $name] {
set file $name
@@ -313,6 +313,22 @@ if ![info exists LDFLAGS] then {
set LDFLAGS {}
}
+if { ![info exists DT_RELR_LDFLAGS] } then {
+ set DT_RELR_LDFLAGS "-z pack-relative-relocs"
+}
+
+if { ![info exists DT_RELR_CC_LDFLAGS] } then {
+ set DT_RELR_CC_LDFLAGS "-Wl,-z,pack-relative-relocs"
+}
+
+if { ![info exists NO_DT_RELR_LDFLAGS] } then {
+ set NO_DT_RELR_LDFLAGS "-z nopack-relative-relocs"
+}
+
+if { ![info exists NO_DT_RELR_CC_LDFLAGS] } then {
+ set NO_DT_RELR_CC_LDFLAGS "-Wl,-z,nopack-relative-relocs"
+}
+
# Set LD_CLASS to "64bit" for a 64-bit *host* linker.
if { ![info exists LD_CLASS] } then {
set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]]
@@ -452,7 +452,8 @@ setup_xfail mips*-*-* bfin-*-*
clear_xfail bfin-*-linux*
run_ld_link_tests [list \
[list "-Bsymbolic-functions" \
- "-shared -Bsymbolic-functions" "" "$AFLAGS_PIC" \
+ "-shared -Bsymbolic-functions $NO_DT_RELR_LDFLAGS" \
+ "" "$AFLAGS_PIC" \
{symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}} \
"symbolic-func.so"] \
]
@@ -74,7 +74,7 @@ run_ld_link_tests [list \
run_ld_link_tests [list \
[list \
"$testname (final shared object)" \
- "-shared -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
+ "-shared $NO_DT_RELR_LDFLAGS -Tdata=0x12340000 tmpdir/i386-export-class-ref-r.o tmpdir/i386-export-class-lib.so" "" \
"" \
{ ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
{ \
@@ -177,12 +177,6 @@ set i386tests {
{{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
{objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
"tlsbindesc"}
- {"TLS -fno-pic -shared"
- "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
- -z noseparate-code --hash-style=sysv" ""
- "--32" {tlsnopic1.s tlsnopic2.s}
- {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
- {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
{"TLS with global dynamic and descriptors"
"-shared -melf_i386 --no-ld-generated-unwind-info \
-z noseparate-code --hash-style=sysv" ""
@@ -293,6 +287,20 @@ iamcu_tests
run_ld_link_tests $i386tests
+run_ld_link_tests [list \
+ [list \
+ "TLS -fno-pic -shared" \
+ "-shared -melf_i386 --no-ld-generated-unwind-info -z notext \
+ -z noseparate-code --hash-style=sysv $NO_DT_RELR_LDFLAGS" \
+ "" "--32" \
+ {tlsnopic1.s tlsnopic2.s} \
+ {{readelf -Ssrl tlsnopic.rd} \
+ {objdump -drj.text tlsnopic.dd} \
+ {objdump -sj.got tlsnopic.sd}} \
+ "libtlsnopic.so" \
+ ] \
+]
+
run_dump_test "abs"
run_dump_test "pcrel8"
run_dump_test "pcrel16"
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --32
-#ld: -pie -melf_i386 -z report-relative-reloc
+#ld: -pie -melf_i386 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide
@@ -1,5 +1,5 @@
#source: ifunc-2-i386.s
-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
@@ -1,5 +1,5 @@
#source: ifunc-2-local-i386.s
-#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code
+#ld: -z now -m elf_i386 -shared --hash-style=sysv -z noseparate-code $NO_DT_RELR_LDFLAGS
#as: --32
#objdump: -dw
#target: x86_64-*-* i?86-*-*
@@ -1,6 +1,6 @@
#source: ifunc-2-local-x86-64.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#target: x86_64-*-*
@@ -1,6 +1,6 @@
#source: ifunc-2-x86-64.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#target: x86_64-*-*
@@ -1,6 +1,6 @@
#source: pr17154-x86.s
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#target: x86_64-*-*
@@ -1,6 +1,6 @@
#source: pr17154-x86.s
#as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#target: x86_64-*-*
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s -mx86-used-note=no
#as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: bnd-ifunc-1.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: bnd-ifunc-2.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,5 +1,5 @@
#as: --64 -madd-bnd-prefix -mx86-used-note=no
-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#...
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s
#as: --64 -mx86-used-note=no
-#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -z now -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: bnd-branch-1.s
#as: --64 -mx86-used-note=no
-#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 -z bndplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -31,6 +31,7 @@ if { ![istarget x86_64*-*-linux*] } {
}
proc x86_64_export_class_test { abi flag emul } {
+ global NO_DT_RELR_LDFLAGS
set testname "x86-64 $abi symbol export class test"
@@ -75,7 +76,7 @@ proc x86_64_export_class_test { abi flag emul } {
run_ld_link_tests [list \
[list \
"$testname (final shared object)" \
- "$LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
+ "$LDFLAGS $NO_DT_RELR_LDFLAGS -shared -Tdata=0x12340000 tmpdir/x86-64-$abi-export-class-ref-r.o tmpdir/x86-64-$abi-export-class-lib.so" "" \
"$AFLAGS" \
{ ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
[list \
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: ibt-plt-3.s
#as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,5 +1,5 @@
#as: --x32
-#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv
+#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv $NO_DT_RELR_LDFLAGS
#readelf: -d -S --wide
#target: x86_64-*-linux*
@@ -1,6 +1,6 @@
#source: load1.s
#as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: load1.s
#as: --x32
-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,7 +1,7 @@
#source: pr13082-2.s
#name: PR ld/13082-2 (b)
#as: --x32
-#ld: -pie -melf32_x86_64
+#ld: -pie -melf32_x86_64 $NO_DT_RELR_LDFLAGS
#readelf: -r --wide
Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
@@ -1,6 +1,6 @@
#name: PR ld/14207
#as: --64
-#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -melf_x86_64 -shared -z relro -z now --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#readelf: -l --wide
#target: x86_64-*-linux*
@@ -1,6 +1,6 @@
#name: PR ld/18176
#as: --64
-#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000
+#ld: -melf_x86_64 -shared -z relro -T pr18176.t -z max-page-size=0x200000 -z common-page-size=0x1000 $NO_DT_RELR_LDFLAGS
#readelf: -l --wide
#target: x86_64-*-linux*
@@ -1,7 +1,7 @@
#source: pr19162a.s
#source: pr19162b.s
#as: --64
-#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv
+#ld: -melf_x86_64 -shared -z noseparate-code -z max-page-size=0x200000 -z common-page-size=0x1000 --hash-style=sysv $NO_DT_RELR_LDFLAGS
#readelf: -l --wide
#target: x86_64-*-linux*
@@ -1,6 +1,6 @@
#source: pr19636-2.s
#as: --64 -mrelax-relocations=no
-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr19636-2.s
#as: --64 -mrelax-relocations=no
-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
#warning: -z dynamic-undefined-weak ignored
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --64
-#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --x32
-#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -pie -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr20253-1.s
#as: --x32
-#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf32_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --x32
-#ld: -pie -melf32_x86_64 -z report-relative-reloc
+#ld: -pie -melf32_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --64
-#ld: -pie -melf_x86_64 -z report-relative-reloc
+#ld: -pie -melf_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide
@@ -45,28 +45,6 @@ set x86_64tests {
{"basic PLT generation"
"-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
{{objdump -drj.plt plt.pd}} "plt"}
- {"TLS -fpic -shared transitions"
- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
- "--64" {tlspic1.s tlspic2.s}
- {{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd}
- {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
- "libtlspic.so"}
- {"TLS -fpic -shared transitions with r15 as GOT base"
- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
- "--64 -mrelax-relocations=yes"
- {tlspic3.s tlspic2.s}
- {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
- {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
- "libtlspic2.so"}
- {"TLS descriptor -fpic -shared transitions"
- "-shared -melf_x86_64 --no-ld-generated-unwind-info \
- -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
- "--64" {tlsdesc.s tlspic2.s}
- {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
- {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
- {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
{"Helper shared library" "-shared -melf_x86_64" ""
"--64" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
@@ -240,6 +218,49 @@ set x86_64tests {
run_ld_link_tests $x86_64tests
+run_ld_link_tests [list \
+ [list \
+ "TLS -fpic -shared transitions" \
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ $NO_DT_RELR_LDFLAGS" \
+ "" "--64" \
+ {tlspic1.s tlspic2.s} \
+ {{readelf -WSsrl tlspic.rd} \
+ {objdump {-drj.text -Mintel64} tlspic.dd} \
+ {objdump -sj.got tlspic.sd} \
+ {objdump -sj.tdata tlspic.td}} \
+ "libtlspic.so" \
+ ] \
+ [list \
+ "TLS -fpic -shared transitions with r15 as GOT base" \
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ $NO_DT_RELR_LDFLAGS" \
+ "" "--64 -mrelax-relocations=yes" \
+ {tlspic3.s tlspic2.s} \
+ {{readelf -WSsrl tlspic2.rd} \
+ {objdump {-drj.text -Mintel64} tlspic2.dd} \
+ {objdump -sj.got tlspic2.sd} \
+ {objdump -sj.tdata tlspic2.td}} \
+ "libtlspic2.so" \
+ ] \
+ [list \
+ "TLS descriptor -fpic -shared transitions" \
+ "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+ -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
+ $NO_DT_RELR_LDFLAGS" \
+ "" "--64" \
+ {tlsdesc.s tlspic2.s} \
+ {{readelf -WSsrld tlsdesc.rd} \
+ {objdump -drj.text tlsdesc.dd} \
+ {objdump {-s -j.got -j.got.plt} tlsdesc.sd} \
+ {objdump -sj.tdata tlsdesc.td} \
+ {objdump -drj.plt tlsdesc.pd}} \
+ "libtlsdesc.so" \
+ ] \
+]
+
set test_name "Mixed x86_64 and i386 input test 1"
set test mixed1
if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {