elf: Support DT_RELR in linker tests

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/pr26869.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.
This commit is contained in:
H.J. Lu
2022-01-05 07:12:03 -08:00
parent 23cc1de50b
commit f2e37a5c7f
43 changed files with 139 additions and 67 deletions

View File

@ -855,6 +855,7 @@ proc run_dump_test { name {extra_options {}} } {
global ELFEDIT ELFEDITFLAGS LD LDFLAGS NM NMFLAGS OBJCOPY OBJCOPYFLAGS global ELFEDIT ELFEDITFLAGS LD LDFLAGS NM NMFLAGS OBJCOPY OBJCOPYFLAGS
global OBJDUMP OBJDUMPFLAGS READELF READELFFLAGS STRIP STRIPFLAGS global OBJDUMP OBJDUMPFLAGS READELF READELFFLAGS STRIP STRIPFLAGS
global copyfile env runtests srcdir subdir verbose global copyfile env runtests srcdir subdir verbose
global DT_RELR_LDFLAGS NO_DT_RELR_LDFLAGS
if [string match "*/*" $name] { if [string match "*/*" $name] {
set file $name set file $name

View File

@ -313,6 +313,46 @@ if ![info exists LDFLAGS] then {
set LDFLAGS {} set LDFLAGS {}
} }
if { ![info exists DT_RELR_LDFLAGS] } then {
if { [istarget "i?86-*-linux*"] \
|| [istarget "x86_64-*-linux*"] \
|| [istarget "i?86-*-gnu**"] } then {
set DT_RELR_LDFLAGS "-z pack-relative-relocs"
} else {
set DT_RELR_LDFLAGS {}
}
}
if { ![info exists DT_RELR_CC_LDFLAGS] } then {
if { [istarget "i?86-*-linux*"] \
|| [istarget "x86_64-*-linux*"] \
|| [istarget "i?86-*-gnu**"] } then {
set DT_RELR_CC_LDFLAGS "-Wl,-z,pack-relative-relocs"
} else {
set DT_RELR_CC_LDFLAGS {}
}
}
if { ![info exists NO_DT_RELR_LDFLAGS] } then {
if { [istarget "i?86-*-linux*"] \
|| [istarget "x86_64-*-linux*"] \
|| [istarget "i?86-*-gnu**"] } then {
set NO_DT_RELR_LDFLAGS "-z nopack-relative-relocs"
} else {
set NO_DT_RELR_LDFLAGS {}
}
}
if { ![info exists NO_DT_RELR_CC_LDFLAGS] } then {
if { [istarget "i?86-*-linux*"] \
|| [istarget "x86_64-*-linux*"] \
|| [istarget "i?86-*-gnu**"] } then {
set NO_DT_RELR_CC_LDFLAGS "-Wl,-z,nopack-relative-relocs"
} else {
set NO_DT_RELR_CC_LDFLAGS {}
}
}
# Set LD_CLASS to "64bit" for a 64-bit *host* linker. # Set LD_CLASS to "64bit" for a 64-bit *host* linker.
if { ![info exists LD_CLASS] } then { if { ![info exists LD_CLASS] } then {
set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]] set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]]

View File

@ -452,7 +452,8 @@ setup_xfail mips*-*-* bfin-*-*
clear_xfail bfin-*-linux* clear_xfail bfin-*-linux*
run_ld_link_tests [list \ run_ld_link_tests [list \
[list "-Bsymbolic-functions" \ [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.s} {{readelf {-r --wide} symbolic-func.r}} \
"symbolic-func.so"] \ "symbolic-func.so"] \
] ]

View File

@ -74,7 +74,7 @@ run_ld_link_tests [list \
run_ld_link_tests [list \ run_ld_link_tests [list \
[list \ [list \
"$testname (final shared object)" \ "$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 } \ { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
{ \ { \

View File

@ -177,12 +177,6 @@ set i386tests {
{{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
{objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
"tlsbindesc"} "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" {"TLS with global dynamic and descriptors"
"-shared -melf_i386 --no-ld-generated-unwind-info \ "-shared -melf_i386 --no-ld-generated-unwind-info \
-z noseparate-code --hash-style=sysv" "" -z noseparate-code --hash-style=sysv" ""
@ -293,6 +287,20 @@ iamcu_tests
run_ld_link_tests $i386tests 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 "abs"
run_dump_test "pcrel8" run_dump_test "pcrel8"
run_dump_test "pcrel16" run_dump_test "pcrel16"

View File

@ -1,6 +1,6 @@
#source: ibt-plt-2.s #source: ibt-plt-2.s
#as: --32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: ibt-plt-3.s #source: ibt-plt-3.s
#as: --32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: ibt-plt-3.s #source: ibt-plt-3.s
#as: --32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,5 +1,5 @@
#as: --32 #as: --32
#ld: -shared -melf_i386 #ld: -shared -melf_i386 $NO_DT_RELR_LDFLAGS
#readelf: -r -s --wide #readelf: -r -s --wide
Relocation section '.rel.dyn' at offset 0x[a-f0-9]+ contains 1 entry: Relocation section '.rel.dyn' at offset 0x[a-f0-9]+ contains 1 entry:

View File

@ -1,6 +1,6 @@
#source: report-reloc-1.s #source: report-reloc-1.s
#as: --32 #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 #warning_output: report-reloc-1.l
#readelf: -r --wide #readelf: -r --wide

View File

@ -1,5 +1,5 @@
#source: ifunc-2-i386.s #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 #as: --32
#objdump: -dw #objdump: -dw
#target: x86_64-*-* i?86-*-* #target: x86_64-*-* i?86-*-*

View File

@ -1,5 +1,5 @@
#source: ifunc-2-local-i386.s #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 #as: --32
#objdump: -dw #objdump: -dw
#target: x86_64-*-* i?86-*-* #target: x86_64-*-* i?86-*-*

View File

@ -1,6 +1,6 @@
#source: ifunc-2-local-x86-64.s #source: ifunc-2-local-x86-64.s
#as: --64 #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 #objdump: -dw
#target: x86_64-*-* #target: x86_64-*-*

View File

@ -1,6 +1,6 @@
#source: ifunc-2-x86-64.s #source: ifunc-2-x86-64.s
#as: --64 #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 #objdump: -dw
#target: x86_64-*-* #target: x86_64-*-*

View File

@ -1,6 +1,6 @@
#source: pr17154-x86.s #source: pr17154-x86.s
#as: --64 #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 #objdump: -dw
#target: x86_64-*-* #target: x86_64-*-*

View File

@ -1,6 +1,6 @@
#source: pr17154-x86.s #source: pr17154-x86.s
#as: --64 #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 #objdump: -dw
#target: x86_64-*-* #target: x86_64-*-*

View File

@ -1,6 +1,6 @@
#source: bnd-branch-1.s -mx86-used-note=no #source: bnd-branch-1.s -mx86-used-note=no
#as: --64 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: bnd-ifunc-1.s #source: bnd-ifunc-1.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: bnd-ifunc-2.s #source: bnd-ifunc-2.s
#as: --64 -madd-bnd-prefix -mx86-used-note=no #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,5 +1,5 @@
#as: --64 -madd-bnd-prefix -mx86-used-note=no #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 #objdump: -dw
#... #...

View File

@ -1,6 +1,6 @@
#source: bnd-branch-1.s #source: bnd-branch-1.s
#as: --64 -mx86-used-note=no #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: bnd-branch-1.s #source: bnd-branch-1.s
#as: --64 -mx86-used-note=no #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -31,6 +31,7 @@ if { ![istarget x86_64*-*-linux*] } {
} }
proc x86_64_export_class_test { abi flag emul } { proc x86_64_export_class_test { abi flag emul } {
global NO_DT_RELR_LDFLAGS
set testname "x86-64 $abi symbol export class test" 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 \ run_ld_link_tests [list \
[list \ [list \
"$testname (final shared object)" \ "$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" \ "$AFLAGS" \
{ ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \ { ../ld-elf/export-class-dep.s ../ld-elf/export-class-def.s } \
[list \ [list \

View File

@ -1,6 +1,6 @@
#source: ibt-plt-2.s #source: ibt-plt-2.s
#as: --x32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: ibt-plt-2.s #source: ibt-plt-2.s
#as: --64 -defsym __64_bit__=1 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: ibt-plt-3.s #source: ibt-plt-3.s
#as: --x32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: ibt-plt-3.s #source: ibt-plt-3.s
#as: --64 -defsym __64_bit__=1 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,5 +1,5 @@
#as: --x32 #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 #readelf: -d -S --wide
#target: x86_64-*-linux* #target: x86_64-*-linux*

View File

@ -1,6 +1,6 @@
#source: load1.s #source: load1.s
#as: --64 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: load1.s #source: load1.s
#as: --x32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,7 +1,7 @@
#source: pr13082-2.s #source: pr13082-2.s
#name: PR ld/13082-2 (b) #name: PR ld/13082-2 (b)
#as: --x32 #as: --x32
#ld: -pie -melf32_x86_64 #ld: -pie -melf32_x86_64 $NO_DT_RELR_LDFLAGS
#readelf: -r --wide #readelf: -r --wide
Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry: Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entry:

View File

@ -1,6 +1,6 @@
#name: PR ld/14207 #name: PR ld/14207
#as: --64 #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 #readelf: -l --wide
#target: x86_64-*-linux* #target: x86_64-*-linux*

View File

@ -1,6 +1,6 @@
#name: PR ld/18176 #name: PR ld/18176
#as: --64 #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 #readelf: -l --wide
#target: x86_64-*-linux* #target: x86_64-*-linux*

View File

@ -1,7 +1,7 @@
#source: pr19162a.s #source: pr19162a.s
#source: pr19162b.s #source: pr19162b.s
#as: --64 #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 #readelf: -l --wide
#target: x86_64-*-linux* #target: x86_64-*-linux*

View File

@ -1,6 +1,6 @@
#source: pr19636-2.s #source: pr19636-2.s
#as: --64 -mrelax-relocations=no #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: pr19636-2.s #source: pr19636-2.s
#as: --64 -mrelax-relocations=no #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 #objdump: -dw
#warning: -z dynamic-undefined-weak ignored #warning: -z dynamic-undefined-weak ignored

View File

@ -1,6 +1,6 @@
#source: pr20253-1.s #source: pr20253-1.s
#as: --64 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: pr20253-1.s #source: pr20253-1.s
#as: --64 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: pr20253-1.s #source: pr20253-1.s
#as: --x32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: pr20253-1.s #source: pr20253-1.s
#as: --x32 #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 #objdump: -dw
.*: +file format .* .*: +file format .*

View File

@ -1,6 +1,6 @@
#source: report-reloc-1.s #source: report-reloc-1.s
#as: --x32 #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 #warning_output: report-reloc-1.l
#readelf: -r --wide #readelf: -r --wide

View File

@ -1,6 +1,6 @@
#source: report-reloc-1.s #source: report-reloc-1.s
#as: --64 #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 #warning_output: report-reloc-1.l
#readelf: -r --wide #readelf: -r --wide

View File

@ -45,28 +45,6 @@ set x86_64tests {
{"basic PLT generation" {"basic PLT generation"
"-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s} "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
{{objdump -drj.plt plt.pd}} "plt"} {{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" "" {"Helper shared library" "-shared -melf_x86_64" ""
"--64" {tlslib.s} {} "libtlslib.so"} "--64" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions" {"TLS -fpic and -fno-pic exec transitions"
@ -240,6 +218,49 @@ set x86_64tests {
run_ld_link_tests $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_name "Mixed x86_64 and i386 input test 1"
set test mixed1 set test mixed1
if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } { if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {