aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/i386.exp161
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-1.d4
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2a.d4
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2b.d49
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2c.d4
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2d.d49
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3a.d4
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3b.d48
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3c.d4
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3d.d49
-rw-r--r--ld/testsuite/ld-i386/pie1-nacl.d18
-rw-r--r--ld/testsuite/ld-i386/pie1.d17
-rw-r--r--ld/testsuite/ld-i386/pie1.s5
-rw-r--r--ld/testsuite/ld-i386/plt-pic2.dd16
-rw-r--r--ld/testsuite/ld-i386/pr19636-1d.d6
-rw-r--r--ld/testsuite/ld-i386/pr19636-2b.d2
-rw-r--r--ld/testsuite/ld-i386/pr19636-2c.d10
-rw-r--r--ld/testsuite/ld-i386/pr20830.d2
-rw-r--r--ld/testsuite/ld-i386/pr21884-nacl.d10
-rw-r--r--ld/testsuite/ld-i386/pr21884-nacl.t11
-rw-r--r--ld/testsuite/ld-i386/pr21884.d10
-rw-r--r--ld/testsuite/ld-i386/pr21884.t11
-rw-r--r--ld/testsuite/ld-i386/pr21997-1a.S35
-rw-r--r--ld/testsuite/ld-i386/pr21997-1b.c16
-rw-r--r--ld/testsuite/ld-i386/pr21997-1c.S51
-rw-r--r--ld/testsuite/ld-i386/pr22001-1a.c13
-rw-r--r--ld/testsuite/ld-i386/pr22001-1b.c14
-rw-r--r--ld/testsuite/ld-i386/pr22001-1c.S51
-rw-r--r--ld/testsuite/ld-i386/pr22115-1.s7
-rw-r--r--ld/testsuite/ld-i386/pr22115-1a.d13
-rw-r--r--ld/testsuite/ld-i386/pr22115-1b.d6
-rw-r--r--ld/testsuite/ld-i386/pr22115-1c.d13
-rw-r--r--ld/testsuite/ld-i386/pr22115-1d.d6
-rw-r--r--ld/testsuite/ld-i386/pr22135.d12
-rw-r--r--ld/testsuite/ld-i386/pr22135.s11
-rw-r--r--ld/testsuite/ld-i386/protected7.d13
-rw-r--r--ld/testsuite/ld-i386/protected7.s31
37 files changed, 729 insertions, 57 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 6c53046..d79c4583 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -24,23 +24,24 @@
if {[istarget "i?86-*-vxworks"]} {
set i386tests {
- {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" ""
+ {"VxWorks shared library test 1"
+ "-shared -Tvxworks1.ld --hash-style=sysv" ""
"" {vxworks1-lib.s}
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
{readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
"libvxworks1.so"}
{"VxWorks executable test 1 (dynamic)" \
- "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" ""
+ "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" ""
"" {vxworks1.s}
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
"vxworks1"}
{"VxWorks executable test 2 (dynamic)" \
- "-Tvxworks1.ld -q --force-dynamic" ""
+ "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" ""
"" {vxworks2.s}
{{readelf --segments vxworks2.sd}}
"vxworks2"}
{"VxWorks executable test 2 (static)"
- "-Tvxworks1.ld" ""
+ "-Tvxworks1.ld --hash-style=sysv" ""
"" {vxworks2.s}
{{readelf --segments vxworks2-static.sd}}
"vxworks2"}
@@ -128,20 +129,20 @@ set i386tests {
"-shared -melf_i386 tmpdir/libpltlib.so" "" "--32" {plt-pic.s}
{{objdump -drj.plt plt-pic.pd}} "libplt-pic.so"}
{"TLS -fpic -shared transitions"
- "-shared -melf_i386 --no-ld-generated-unwind-info" ""
+ "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" ""
"--32" {tlspic1.s tlspic2.s}
{{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd}
{objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
"libtlspic.so"}
{"TLS -fpic -shared transitions without PLT"
- "-shared -melf_i386 --no-ld-generated-unwind-info" ""
+ "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" ""
"-mrelax-relocations=yes --32"
{tlspic3.s tlspic2.s}
{{readelf -Ssrl tlspic2.rd} {objdump -drj.text tlspic2.dd}
{objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
"libtlspic2.so"}
{"TLS descriptor -fpic -shared transitions"
- "-shared -melf_i386 --no-ld-generated-unwind-info" ""
+ "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" ""
"--32" {tlsdesc.s tlspic2.s}
{{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
{objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
@@ -149,31 +150,31 @@ set i386tests {
{"Helper shared library" "-shared -melf_i386" ""
"--32" {tlslib.s} {} "libtlslib.so"}
{"TLS -fpic and -fno-pic exec transitions"
- "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" ""
+ "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" ""
"--32" {tlsbinpic.s tlsbin.s}
{{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
{objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
"tlsbin"}
{"TLS -fpic and -fno-pic exec transitions without PLT"
- "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" ""
+ "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" ""
"-mrelax-relocations=yes --32"
{tlsbinpic2.s tlsbin.s}
{{readelf -Ssrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd}
{objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}}
"tlsbin2"}
{"TLS descriptor -fpic and -fno-pic exec transitions"
- "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info" ""
+ "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info --hash-style=sysv" ""
"--32" {tlsbindesc.s tlsbin.s}
{{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" ""
+ "-shared -melf_i386 --no-ld-generated-unwind-info --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" ""
+ "-shared -melf_i386 --no-ld-generated-unwind-info --hash-style=sysv" ""
"--32" {tlsgdesc.s}
{{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
"libtlsgdesc.so"}
@@ -307,6 +308,7 @@ run_dump_test "protected4"
run_dump_test "protected5"
run_dump_test "protected6a"
run_dump_test "protected6b"
+run_dump_test "protected7"
run_dump_test "tlspie1"
run_dump_test "tlspie2"
run_dump_test "tlspie3a"
@@ -434,6 +436,15 @@ run_dump_test "property-x86-shstk3a"
run_dump_test "property-x86-shstk3b"
run_dump_test "property-x86-shstk4"
run_dump_test "property-x86-shstk5"
+run_dump_test "pie1"
+run_dump_test "pie1-nacl"
+run_dump_test "pr21884"
+run_dump_test "pr21884-nacl"
+run_dump_test "pr22115-1a"
+run_dump_test "pr22115-1b"
+run_dump_test "pr22115-1c"
+run_dump_test "pr22115-1d"
+run_dump_test "pr22135"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
@@ -462,8 +473,8 @@ proc undefined_weak {cflags ldflags} {
set testname "$testname ($cflags $ldflags)"
}
- if { [ regexp "\-fPIE" $cflags]
- && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } {
+ if { [string match "*-fPIE*" $cflags]
+ && ![string match "*-z nodynamic-undefined-weak*" $ldflags] } {
set weak_symbol "Weak defined"
} else {
set weak_symbol "Weak undefined"
@@ -1239,6 +1250,25 @@ if { [isnative]
if { [isnative]
&& [istarget "i?86-*-*"]
&& [which $CC] != 0 } {
+ run_cc_link_tests [list \
+ [list \
+ "Build pr22001-1.so" \
+ "-shared" \
+ "" \
+ { pr22001-1a.c } \
+ {} \
+ "pr22001-1.so" \
+ ] \
+ [list \
+ "Build pr21997-1.so" \
+ "-shared" \
+ "" \
+ { property-stack.S property-no-copy.S pr21997-1a.S } \
+ {} \
+ "pr21997-1.so" \
+ ] \
+ ]
+
run_ld_link_exec_tests [list \
[list \
"Run weakundef1 without PIE" \
@@ -1250,15 +1280,106 @@ if { [isnative]
"$NOPIE_CFLAGS" \
] \
[list \
- "Run weakundef1 with PIE" \
- "-pie" \
+ "Run pr22001-1" \
+ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
"" \
- { weakundef1.c } \
- "weakundef1pie" \
+ { pr22001-1b.c } \
+ "pr22001-1" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run pr22001-1 (PIE 1)" \
+ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+ "" \
+ { pr22001-1c.S } \
+ "pr22001-1-pie-1" \
+ "pass.out" \
+ ] \
+ [list \
+ "Run pr22001-1 (PIE 2)" \
+ "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+ "" \
+ { pr22001-1c.S } \
+ "pr22001-1-pie-2" \
+ "pass.out" \
+ ] \
+ [list \
+ "Run pr22001-1 (PIC 1)" \
+ "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+ "" \
+ { pr22001-1b.c } \
+ "pr22001-1-pic-1" \
+ "pass.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run pr22001-1 (PIC 2)" \
+ "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+ "" \
+ { pr22001-1b.c } \
+ "pr22001-1-pic-2" \
+ "pass.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run pr21997-1" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+ "" \
+ { pr21997-1b.c } \
+ "pr21997-1" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run pr21997-1 (PIC 1)" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+ "" \
+ { pr21997-1b.c } \
+ "pr21997-1-pic-1" \
+ "pass.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run pr21997-1 (PIC 2)" \
+ "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+ "" \
+ { pr21997-1b.c } \
+ "pr21997-1-pic-2" \
+ "pass.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run pr21997-1 (PIE 1)" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+ "" \
+ { pr21997-1c.S } \
+ "pr21997-1-pie-1" \
+ "pass.out" \
+ ] \
+ [list \
+ "Run pr21997-1 (PIE 2)" \
+ "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+ "" \
+ { pr21997-1c.S } \
+ "pr21997-1-pie-2" \
"pass.out" \
- "-fPIE" \
] \
]
+
+ if { [at_least_gcc_version 5 0] } {
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run weakundef1 with PIE" \
+ "-pie" \
+ "" \
+ { weakundef1.c } \
+ "weakundef1pie" \
+ "pass.out" \
+ "-fPIE" \
+ ] \
+ ]
+ }
}
if { !([istarget "i?86-*-linux*"]
@@ -1269,7 +1390,7 @@ if { !([istarget "i?86-*-linux*"]
run_ld_link_tests [list \
[list \
"basic PLT generation (non-PIC, -z now)" \
- "-z now -melf_i386 tmpdir/libpltlib.so" \
+ "-z now -melf_i386 --hash-style=sysv tmpdir/libpltlib.so" \
"" \
"--32" \
{plt2.s} \
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d
index 1c90591..a131675 100644
--- a/ld/testsuite/ld-i386/ibt-plt-1.d
+++ b/ld/testsuite/ld-i386/ibt-plt-1.d
@@ -1,5 +1,5 @@
#as: --32
-#ld: -shared -m elf_i386
+#ld: -shared -m elf_i386 --hash-style=sysv
#objdump: -dw
.*: +file format .*
@@ -37,7 +37,7 @@ Disassembly of section .text:
0+200 <foo>:
+[a-f0-9]+: 53 push %ebx
+[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
- +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d
index 4881dea..13c6949 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
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv
#objdump: -dw
.*: +file format .*
@@ -38,7 +38,7 @@ Disassembly of section .text:
0+200 <foo>:
+[a-f0-9]+: 53 push %ebx
+[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
- +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
diff --git a/ld/testsuite/ld-i386/ibt-plt-2b.d b/ld/testsuite/ld-i386/ibt-plt-2b.d
index 740b889..90541f1 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2b.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2b.d
@@ -1,7 +1,52 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt
-#readelf: -n
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv
+#readelf: -n -wf
+
+Contents of the .eh_frame section:
+
+0+ 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 8
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r4 \(esp\) ofs 4
+ DW_CFA_offset: r8 \(eip\) at cfa-4
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e
+ DW_CFA_advance_loc: 1 to 00000201
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_offset: r3 \(ebx\) at cfa-8
+ DW_CFA_advance_loc: 14 to 0000020f
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_advance_loc: 13 to 0000021c
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 1 to 0000021d
+ DW_CFA_restore: r3 \(ebx\)
+ DW_CFA_def_cfa_offset: 4
+
+0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 6 to 000001b6
+ DW_CFA_def_cfa_offset: 12
+ DW_CFA_advance_loc: 10 to 000001c0
+ DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\)
+
+0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
Displaying notes found in: .note.gnu.property
Owner Data size Description
diff --git a/ld/testsuite/ld-i386/ibt-plt-2c.d b/ld/testsuite/ld-i386/ibt-plt-2c.d
index 2ba1d78..63f4427 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2c.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2c.d
@@ -1,6 +1,6 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibt
+#ld: -shared -m elf_i386 -z ibt --hash-style=sysv
#objdump: -dw
.*: +file format .*
@@ -38,7 +38,7 @@ Disassembly of section .text:
0+200 <foo>:
+[a-f0-9]+: 53 push %ebx
+[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
- +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 81 c3 36 11 00 00 add \$0x1136,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
diff --git a/ld/testsuite/ld-i386/ibt-plt-2d.d b/ld/testsuite/ld-i386/ibt-plt-2d.d
index 3e02a62..f57c7e8 100644
--- a/ld/testsuite/ld-i386/ibt-plt-2d.d
+++ b/ld/testsuite/ld-i386/ibt-plt-2d.d
@@ -1,7 +1,52 @@
#source: ibt-plt-2.s
#as: --32
-#ld: -shared -m elf_i386 -z ibt
-#readelf: -n
+#ld: -shared -m elf_i386 -z ibt --hash-style=sysv
+#readelf: -n -wf
+
+Contents of the .eh_frame section:
+
+0+ 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 8
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r4 \(esp\) ofs 4
+ DW_CFA_offset: r8 \(eip\) at cfa-4
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e
+ DW_CFA_advance_loc: 1 to 00000201
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_offset: r3 \(ebx\) at cfa-8
+ DW_CFA_advance_loc: 14 to 0000020f
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_advance_loc: 13 to 0000021c
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 1 to 0000021d
+ DW_CFA_restore: r3 \(ebx\)
+ DW_CFA_def_cfa_offset: 4
+
+0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 6 to 000001b6
+ DW_CFA_def_cfa_offset: 12
+ DW_CFA_advance_loc: 10 to 000001c0
+ DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\)
+
+0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
Displaying notes found in: .note.gnu.property
Owner Data size Description
diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d
index c2ce3fd..5455c92 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
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv
#objdump: -dw
.*: +file format .*
@@ -38,7 +38,7 @@ Disassembly of section .text:
0+1e0 <foo>:
+[a-f0-9]+: 53 push %ebx
+[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx>
- +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx
+ +[a-f0-9]+: 81 c3 1a 11 00 00 add \$0x111a,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt>
+[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt>
diff --git a/ld/testsuite/ld-i386/ibt-plt-3b.d b/ld/testsuite/ld-i386/ibt-plt-3b.d
index d9b5be2..6e6637f 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3b.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3b.d
@@ -1,5 +1,49 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibtplt
-#readelf: -n
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv
+#readelf: -wf -n
+
+Contents of the .eh_frame section:
+
+0+ 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 8
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r4 \(esp\) ofs 4
+ DW_CFA_offset: r8 \(eip\) at cfa-4
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+18 0000001c 0000001c FDE cie=00000000 pc=000001e0..000001fe
+ DW_CFA_advance_loc: 1 to 000001e1
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_offset: r3 \(ebx\) at cfa-8
+ DW_CFA_advance_loc: 14 to 000001ef
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_advance_loc: 13 to 000001fc
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 1 to 000001fd
+ DW_CFA_restore: r3 \(ebx\)
+ DW_CFA_def_cfa_offset: 4
+
+0+38 00000010 0000003c FDE cie=00000000 pc=000001fe..00000202
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+4c 00000020 00000050 FDE cie=00000000 pc=00000190..000001c0
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 6 to 00000196
+ DW_CFA_def_cfa_offset: 12
+ DW_CFA_advance_loc: 10 to 000001a0
+ DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\)
+
+0+70 00000010 00000074 FDE cie=00000000 pc=000001c0..000001e0
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d
index c2ce3fd..5455c92 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
+#ld: -shared -m elf_i386 -z ibtplt --hash-style=sysv
#objdump: -dw
.*: +file format .*
@@ -38,7 +38,7 @@ Disassembly of section .text:
0+1e0 <foo>:
+[a-f0-9]+: 53 push %ebx
+[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx>
- +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx
+ +[a-f0-9]+: 81 c3 1a 11 00 00 add \$0x111a,%ebx
+[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt>
+[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt>
diff --git a/ld/testsuite/ld-i386/ibt-plt-3d.d b/ld/testsuite/ld-i386/ibt-plt-3d.d
index 3cf159a..1ef91db 100644
--- a/ld/testsuite/ld-i386/ibt-plt-3d.d
+++ b/ld/testsuite/ld-i386/ibt-plt-3d.d
@@ -1,7 +1,52 @@
#source: ibt-plt-3.s
#as: --32
-#ld: -shared -m elf_i386 -z ibt
-#readelf: -n
+#ld: -shared -m elf_i386 -z ibt --hash-style=sysv
+#readelf: -wf -n
+
+Contents of the .eh_frame section:
+
+0+ 00000014 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -4
+ Return address column: 8
+ Augmentation data: 1b
+
+ DW_CFA_def_cfa: r4 \(esp\) ofs 4
+ DW_CFA_offset: r8 \(eip\) at cfa-4
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+18 0000001c 0000001c FDE cie=00000000 pc=00000200..0000021e
+ DW_CFA_advance_loc: 1 to 00000201
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_offset: r3 \(ebx\) at cfa-8
+ DW_CFA_advance_loc: 14 to 0000020f
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_advance_loc: 13 to 0000021c
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 1 to 0000021d
+ DW_CFA_restore: r3 \(ebx\)
+ DW_CFA_def_cfa_offset: 4
+
+0+38 00000010 0000003c FDE cie=00000000 pc=0000021e..00000222
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+4c 00000020 00000050 FDE cie=00000000 pc=000001b0..000001e0
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 6 to 000001b6
+ DW_CFA_def_cfa_offset: 12
+ DW_CFA_advance_loc: 10 to 000001c0
+ DW_CFA_def_cfa_expression \(DW_OP_breg4 \(esp\): 4; DW_OP_breg8 \(eip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit2; DW_OP_shl; DW_OP_plus\)
+
+0+70 00000010 00000074 FDE cie=00000000 pc=000001e0..00000200
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
Displaying notes found in: .note.gnu.property
Owner Data size Description
diff --git a/ld/testsuite/ld-i386/pie1-nacl.d b/ld/testsuite/ld-i386/pie1-nacl.d
new file mode 100644
index 0000000..aafd6a7
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1-nacl.d
@@ -0,0 +1,18 @@
+#source: pie1.s
+#as: --32
+#ld: -pie -melf_i386 -z relro
+#objdump: -dw --sym
+#target: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+SYMBOL TABLE:
+#...
+10020000 l O .got.plt 0+ _GLOBAL_OFFSET_TABLE_
+#...
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +0: 8d 80 00 00 fe ef lea -0x10020000\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pie1.d b/ld/testsuite/ld-i386/pie1.d
new file mode 100644
index 0000000..e77b8dc
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1.d
@@ -0,0 +1,17 @@
+#as: --32
+#ld: -pie -melf_i386 -z relro
+#objdump: -dw --sym
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+SYMBOL TABLE:
+#...
+0+2000 l O .got.plt 0+ _GLOBAL_OFFSET_TABLE_
+#...
+
+Disassembly of section .text:
+
+.* <_start>:
+.*: 8d 80 00 e0 ff ff lea -0x2000\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pie1.s b/ld/testsuite/ld-i386/pie1.s
new file mode 100644
index 0000000..b4d1d73
--- /dev/null
+++ b/ld/testsuite/ld-i386/pie1.s
@@ -0,0 +1,5 @@
+ .text
+ .global _start
+ .weak foo
+_start:
+ leal foo@GOTOFF(%eax), %eax
diff --git a/ld/testsuite/ld-i386/plt-pic2.dd b/ld/testsuite/ld-i386/plt-pic2.dd
index 4047db5..1d81c76 100644
--- a/ld/testsuite/ld-i386/plt-pic2.dd
+++ b/ld/testsuite/ld-i386/plt-pic2.dd
@@ -9,25 +9,25 @@
Disassembly of section .plt:
-0+180 <.plt>:
+.* <.plt>:
+[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+[a-f0-9]+: 00 00 add %al,\(%eax\)
...
-0+190 <fn1@plt>:
+.* <fn1@plt>:
+[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: e9 e0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 e0 ff ff ff jmp .* <.plt>
-0+1a0 <fn2@plt>:
+.* <fn2@plt>:
+[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+[a-f0-9]+: 68 08 00 00 00 push \$0x8
- +[a-f0-9]+: e9 d0 ff ff ff jmp 180 <.plt>
+ +[a-f0-9]+: e9 d0 ff ff ff jmp .* <.plt>
Disassembly of section .text:
-0+1b0 <foo>:
- +[a-f0-9]+: e8 db ff ff ff call 190 <fn1@plt>
- +[a-f0-9]+: e9 e6 ff ff ff jmp 1a0 <fn2@plt>
+.* <foo>:
+ +[a-f0-9]+: e8 db ff ff ff call .* <fn1@plt>
+ +[a-f0-9]+: e9 e6 ff ff ff jmp .* <fn2@plt>
#pass
diff --git a/ld/testsuite/ld-i386/pr19636-1d.d b/ld/testsuite/ld-i386/pr19636-1d.d
index ac86786..e667cae 100644
--- a/ld/testsuite/ld-i386/pr19636-1d.d
+++ b/ld/testsuite/ld-i386/pr19636-1d.d
@@ -9,7 +9,7 @@
Disassembly of section .plt:
-0+c0 <.plt>:
+.* <.plt>:
[ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
[ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\)
@@ -20,7 +20,7 @@ Disassembly of section .plt:
Disassembly of section .text:
-0+e0 <_start>:
+.* <_start>:
[ ]*[a-f0-9]+: 3b 80 f8 ff ff ff cmp -0x8\(%eax\),%eax
[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\)
-[ ]*[a-f0-9]+: e8 df ff ff ff call d0 <.*>
+[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10>
diff --git a/ld/testsuite/ld-i386/pr19636-2b.d b/ld/testsuite/ld-i386/pr19636-2b.d
index 9a0a263..ac21025 100644
--- a/ld/testsuite/ld-i386/pr19636-2b.d
+++ b/ld/testsuite/ld-i386/pr19636-2b.d
@@ -10,8 +10,6 @@ Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 1 entries:
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start
-#...
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +WEAK +DEFAULT +UND +func
#...
diff --git a/ld/testsuite/ld-i386/pr19636-2c.d b/ld/testsuite/ld-i386/pr19636-2c.d
index 08db119..3c7cd6d 100644
--- a/ld/testsuite/ld-i386/pr19636-2c.d
+++ b/ld/testsuite/ld-i386/pr19636-2c.d
@@ -9,20 +9,20 @@
Disassembly of section .plt:
-0+130 <.plt>:
+.* <.plt>:
[ ]*[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
[ ]*[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\)
[ ]*[a-f0-9]+: 00 00 add %al,\(%eax\)
[ ]*[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
[ ]*[a-f0-9]+: 68 00 00 00 00 push \$0x0
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 150 <_start>
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp .* <_start>
Disassembly of section .text:
-0+150 <_start>:
+.* <_start>:
[ ]*[a-f0-9]+: 3b 80 fc ff ff ff cmp -0x4\(%eax\),%eax
[ ]*[a-f0-9]+: ff a0 fc ff ff ff jmp \*-0x4\(%eax\)
-[ ]*[a-f0-9]+: e8 df ff ff ff call 140 <.*>
+[ ]*[a-f0-9]+: e8 df ff ff ff call .* <\.plt\+0x10>
[ ]*[a-f0-9]+: 3d 00 00 00 00 cmp \$0x0,%eax
-[ ]*[a-f0-9]+: e8 fc ff ff ff call 167 <.*>
+[ ]*[a-f0-9]+: e8 fc ff ff ff call .* <_start\+0x17>
diff --git a/ld/testsuite/ld-i386/pr20830.d b/ld/testsuite/ld-i386/pr20830.d
index 55fe924..26caabb 100644
--- a/ld/testsuite/ld-i386/pr20830.d
+++ b/ld/testsuite/ld-i386/pr20830.d
@@ -1,6 +1,6 @@
#name: PR ld/20830 (.plt.got)
#as: --32
-#ld: -melf_i386 -shared -z relro --ld-generated-unwind-info
+#ld: -melf_i386 -shared -z relro --ld-generated-unwind-info --hash-style=sysv
#objdump: -dw -Wf
.*: +file format .*
diff --git a/ld/testsuite/ld-i386/pr21884-nacl.d b/ld/testsuite/ld-i386/pr21884-nacl.d
new file mode 100644
index 0000000..82daaaa
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21884-nacl.d
@@ -0,0 +1,10 @@
+#source: dummy.s
+#as: --32
+#ld: -m elf_i386 -T pr21884-nacl.t -b binary
+#objdump: -b binary -s
+#target: i?86-*-nacl* x86_64-*-nacl*
+
+.*: file format binary
+
+Contents of section .data:
+#pass
diff --git a/ld/testsuite/ld-i386/pr21884-nacl.t b/ld/testsuite/ld-i386/pr21884-nacl.t
new file mode 100644
index 0000000..3ffb56c
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21884-nacl.t
@@ -0,0 +1,11 @@
+OUTPUT_FORMAT("elf32-i386-nacl");
+OUTPUT_ARCH(i386);
+
+ENTRY(_start);
+SECTIONS {
+ . = 0x10000;
+ _start = . ;
+ .data : {
+ *(.data)
+ }
+}
diff --git a/ld/testsuite/ld-i386/pr21884.d b/ld/testsuite/ld-i386/pr21884.d
new file mode 100644
index 0000000..ea73aa2
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21884.d
@@ -0,0 +1,10 @@
+#source: dummy.s
+#as: --32
+#ld: -m elf_i386 -T pr21884.t -b binary
+#objdump: -b binary -s
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: file format binary
+
+Contents of section .data:
+#pass
diff --git a/ld/testsuite/ld-i386/pr21884.t b/ld/testsuite/ld-i386/pr21884.t
new file mode 100644
index 0000000..4cf8cdc
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21884.t
@@ -0,0 +1,11 @@
+OUTPUT_FORMAT("elf32-i386");
+OUTPUT_ARCH(i386);
+
+ENTRY(_start);
+SECTIONS {
+ . = 0x10000;
+ _start = . ;
+ .data : {
+ *(.data)
+ }
+}
diff --git a/ld/testsuite/ld-i386/pr21997-1a.S b/ld/testsuite/ld-i386/pr21997-1a.S
new file mode 100644
index 0000000..aea17f8
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21997-1a.S
@@ -0,0 +1,35 @@
+ .text
+ .p2align 4,,15
+ .globl get_protected
+ .type get_protected, @function
+get_protected:
+ call __x86.get_pc_thunk.ax
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ movl protected@GOTOFF(%eax), %eax
+ ret
+ .size get_protected, .-get_protected
+ .p2align 4,,15
+ .globl get_protected_p
+ .type get_protected_p, @function
+get_protected_p:
+ call __x86.get_pc_thunk.ax
+ addl $_GLOBAL_OFFSET_TABLE_, %eax
+ leal protected@GOTOFF(%eax), %eax
+ ret
+ .size get_protected_p, .-get_protected_p
+ .protected protected
+ .globl protected
+ .data
+ .align 4
+ .type protected, @object
+ .size protected, 4
+protected:
+ .long 1
+ .section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
+ .globl __x86.get_pc_thunk.ax
+ .hidden __x86.get_pc_thunk.ax
+ .type __x86.get_pc_thunk.ax, @function
+__x86.get_pc_thunk.ax:
+ movl (%esp), %eax
+ ret
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/pr21997-1b.c b/ld/testsuite/ld-i386/pr21997-1b.c
new file mode 100644
index 0000000..576362e
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21997-1b.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern int protected;
+extern int get_protected (void);
+extern int* get_protected_p (void);
+
+int
+main ()
+{
+
+ if (protected == get_protected ()
+ && &protected == get_protected_p ())
+ printf ("PASS\n");
+
+ return 0;
+}
diff --git a/ld/testsuite/ld-i386/pr21997-1c.S b/ld/testsuite/ld-i386/pr21997-1c.S
new file mode 100644
index 0000000..8534877
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr21997-1c.S
@@ -0,0 +1,51 @@
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "PASS"
+ .section .text.startup,"ax",@progbits
+ .p2align 4,,15
+ .globl main
+ .type main, @function
+main:
+ leal 4(%esp), %ecx
+ andl $-16, %esp
+ pushl -4(%ecx)
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %esi
+ pushl %ebx
+ pushl %ecx
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ subl $12, %esp
+ call get_protected@PLT
+ movl protected@GOT(%ebx), %esi
+ cmpl (%esi), %eax
+ je .L7
+.L3:
+ leal -12(%ebp), %esp
+ xorl %eax, %eax
+ popl %ecx
+ popl %ebx
+ popl %esi
+ popl %ebp
+ leal -4(%ecx), %esp
+ ret
+.L7:
+ call get_protected_p@PLT
+ cmpl %esi, %eax
+ jne .L3
+ leal .LC0@GOTOFF(%ebx), %eax
+ subl $12, %esp
+ pushl %eax
+ call puts@PLT
+ addl $16, %esp
+ jmp .L3
+ .size main, .-main
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ .type __x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/pr22001-1a.c b/ld/testsuite/ld-i386/pr22001-1a.c
new file mode 100644
index 0000000..2b55ea8
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22001-1a.c
@@ -0,0 +1,13 @@
+int copy = 1;
+
+int
+get_copy ()
+{
+ return copy;
+}
+
+int *
+get_copy_p ()
+{
+ return &copy;
+}
diff --git a/ld/testsuite/ld-i386/pr22001-1b.c b/ld/testsuite/ld-i386/pr22001-1b.c
new file mode 100644
index 0000000..8eadd42
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22001-1b.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+extern int copy;
+extern int get_copy (void);
+extern int* get_copy_p (void);
+
+int
+main ()
+{
+ if (copy == get_copy () && &copy == get_copy_p ())
+ printf ("PASS\n");
+
+ return 0;
+}
diff --git a/ld/testsuite/ld-i386/pr22001-1c.S b/ld/testsuite/ld-i386/pr22001-1c.S
new file mode 100644
index 0000000..2c1041d
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22001-1c.S
@@ -0,0 +1,51 @@
+ .section .rodata.str1.1,"aMS",@progbits,1
+.LC0:
+ .string "PASS"
+ .section .text.startup,"ax",@progbits
+ .p2align 4,,15
+ .globl main
+ .type main, @function
+main:
+ leal 4(%esp), %ecx
+ andl $-16, %esp
+ pushl -4(%ecx)
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %esi
+ pushl %ebx
+ pushl %ecx
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ subl $12, %esp
+ call get_copy@PLT
+ movl copy@GOT(%ebx), %esi
+ cmpl (%esi), %eax
+ je .L7
+.L3:
+ leal -12(%ebp), %esp
+ xorl %eax, %eax
+ popl %ecx
+ popl %ebx
+ popl %esi
+ popl %ebp
+ leal -4(%ecx), %esp
+ ret
+.L7:
+ call get_copy_p@PLT
+ cmpl %esi, %eax
+ jne .L3
+ leal .LC0@GOTOFF(%ebx), %eax
+ subl $12, %esp
+ pushl %eax
+ call puts@PLT
+ addl $16, %esp
+ jmp .L3
+ .size main, .-main
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ .type __x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-i386/pr22115-1.s b/ld/testsuite/ld-i386/pr22115-1.s
new file mode 100644
index 0000000..341eede
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22115-1.s
@@ -0,0 +1,7 @@
+ .text
+ .globl _start
+ .type _start, @function
+_start:
+ movl __ehdr_start@GOT(%eax), %eax
+ .size _start, .-_start
+ .weak __ehdr_start
diff --git a/ld/testsuite/ld-i386/pr22115-1a.d b/ld/testsuite/ld-i386/pr22115-1a.d
new file mode 100644
index 0000000..4857952
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22115-1a.d
@@ -0,0 +1,13 @@
+#source: pr22115-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -z text -m elf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pr22115-1b.d b/ld/testsuite/ld-i386/pr22115-1b.d
new file mode 100644
index 0000000..bb05851
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22115-1b.d
@@ -0,0 +1,6 @@
+#source: pr22115-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -z text -m elf_i386
+#readelf: -r
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-i386/pr22115-1c.d b/ld/testsuite/ld-i386/pr22115-1c.d
new file mode 100644
index 0000000..ce70539
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22115-1c.d
@@ -0,0 +1,13 @@
+#source: pr22115-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -z text -m elf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pr22115-1d.d b/ld/testsuite/ld-i386/pr22115-1d.d
new file mode 100644
index 0000000..3a0b8e3
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22115-1d.d
@@ -0,0 +1,6 @@
+#source: pr22115-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -z text -m elf_i386 --no-dynamic-linker
+#readelf: -r
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-i386/pr22135.d b/ld/testsuite/ld-i386/pr22135.d
new file mode 100644
index 0000000..a5796ba
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22135.d
@@ -0,0 +1,12 @@
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -melf_i386 --no-keep-memory
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+#...
+[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax
+#pass
diff --git a/ld/testsuite/ld-i386/pr22135.s b/ld/testsuite/ld-i386/pr22135.s
new file mode 100644
index 0000000..6afad88
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr22135.s
@@ -0,0 +1,11 @@
+ .text
+ .globl foo
+ .type foo, @function
+foo:
+ ret
+ .size foo, .-foo
+ .globl _start
+ .type _start, @function
+_start:
+ movl foo@GOT(%ecx), %eax
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-i386/protected7.d b/ld/testsuite/ld-i386/protected7.d
new file mode 100644
index 0000000..aafa2d8
--- /dev/null
+++ b/ld/testsuite/ld-i386/protected7.d
@@ -0,0 +1,13 @@
+#as: --32
+#ld: -shared -melf_i386
+#objdump: -drw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+[a-f0-9]+ <bar>:
+[ ]*[a-f0-9]+: 8b 81 [a-f0-9][a-f0-9] [a-f0-9][a-f0-9] 00 00 mov 0x[a-f0-9]+\(%ecx\),%eax
+[ ]*[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/protected7.s b/ld/testsuite/ld-i386/protected7.s
new file mode 100644
index 0000000..bc2bc91
--- /dev/null
+++ b/ld/testsuite/ld-i386/protected7.s
@@ -0,0 +1,31 @@
+ .protected foo
+.globl foo
+ .data
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .long 1
+ .text
+.globl bar
+ .type bar, @function
+bar:
+ movl foo@GOTOFF(%ecx), %eax
+ ret
+ .size bar, .-bar
+
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length. */
+ .long 3f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+ .p2align 2
+ /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */
+ .long 2 /* pr_type. */
+ .long 0 /* pr_datasz. */
+ .p2align 2
+3: