summaryrefslogtreecommitdiff
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/got1.dd4
-rw-r--r--ld/testsuite/ld-i386/i386.exp14
-rw-r--r--ld/testsuite/ld-i386/lea1c.d8
-rw-r--r--ld/testsuite/ld-i386/load1-nacl.d8
-rw-r--r--ld/testsuite/ld-i386/load1.d8
-rw-r--r--ld/testsuite/ld-i386/load4b.d2
-rw-r--r--ld/testsuite/ld-i386/load5b.d2
-rw-r--r--ld/testsuite/ld-i386/mov1b.d6
-rw-r--r--ld/testsuite/ld-i386/pr19609-1.s12
-rw-r--r--ld/testsuite/ld-i386/pr19609-1a.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1b.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1c.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1d.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1e.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1f.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1g.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1h.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-1i.d17
-rw-r--r--ld/testsuite/ld-i386/pr19609-2.s6
-rw-r--r--ld/testsuite/ld-i386/pr19609-2a.d12
-rw-r--r--ld/testsuite/ld-i386/pr19609-2b.d12
-rw-r--r--ld/testsuite/ld-i386/pr19609-2c.d12
-rw-r--r--ld/testsuite/ld-i386/undefweak.s10
-rw-r--r--ld/testsuite/ld-i386/undefweaka.d9
-rw-r--r--ld/testsuite/ld-i386/undefweakb.d11
25 files changed, 270 insertions, 19 deletions
diff --git a/ld/testsuite/ld-i386/got1.dd b/ld/testsuite/ld-i386/got1.dd
index e6e82dee910..cfea36bf8d6 100644
--- a/ld/testsuite/ld-i386/got1.dd
+++ b/ld/testsuite/ld-i386/got1.dd
@@ -4,7 +4,7 @@
[ ]*[a-f0-9]+: [ a-f0-9]+ addr16 call [a-f0-9]+ <foo>
[ ]*[a-f0-9]+: [ a-f0-9]+ call \*0x[a-f0-9]+
[ ]*[a-f0-9]+: [ a-f0-9]+ call \*0x[a-f0-9]+
-[ ]*[a-f0-9]+: [ a-f0-9]+ lea *0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: [ a-f0-9]+ mov *\$0x[a-f0-9]+,%eax
[ ]*[a-f0-9]+: ff d0 call \*%eax
[ ]*[a-f0-9]+: [ a-f0-9]+ mov *0x[a-f0-9]+,%eax
[ ]*[a-f0-9]+: ff d0 call \*%eax
@@ -12,7 +12,7 @@
[ ]*[a-f0-9]+: ff d0 call \*%eax
[ ]*[a-f0-9]+: [ a-f0-9]+ call [a-f0-9]+ <__x86.get_pc_thunk.cx>
[ ]*[a-f0-9]+: [ a-f0-9]+ add \$0x[a-f0-9]+,%ecx
-[ ]*[a-f0-9]+: [ a-f0-9]+ lea *0x[a-f0-9]+,%ecx
+[ ]*[a-f0-9]+: [ a-f0-9]+ mov *\$0x[a-f0-9]+,%ecx
[ ]*[a-f0-9]+: ff d1 call \*%ecx
[ ]*[a-f0-9]+: 83 ec 0c sub \$0xc,%esp
[ ]*[a-f0-9]+: 6a 00 push \$0x0
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index ab8f017c937..f110e477fa0 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -349,6 +349,20 @@ run_dump_test "pr19636-4a"
run_dump_test "pr19636-4b"
run_dump_test "pr19636-4c"
run_dump_test "pr19636-4d"
+run_dump_test "pr19609-1a"
+run_dump_test "pr19609-1b"
+run_dump_test "pr19609-1c"
+run_dump_test "pr19609-1d"
+run_dump_test "pr19609-1e"
+run_dump_test "pr19609-1f"
+run_dump_test "pr19609-1g"
+run_dump_test "pr19609-1h"
+run_dump_test "pr19609-1i"
+run_dump_test "pr19609-2a"
+run_dump_test "pr19609-2b"
+run_dump_test "pr19609-2c"
+run_dump_test "undefweaka"
+run_dump_test "undefweakb"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/lea1c.d b/ld/testsuite/ld-i386/lea1c.d
index 0c3580d21ae..b461089042a 100644
--- a/ld/testsuite/ld-i386/lea1c.d
+++ b/ld/testsuite/ld-i386/lea1c.d
@@ -9,8 +9,8 @@
Disassembly of section .text:
#...
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
#pass
diff --git a/ld/testsuite/ld-i386/load1-nacl.d b/ld/testsuite/ld-i386/load1-nacl.d
index 1245639a19f..1dbba1107fc 100644
--- a/ld/testsuite/ld-i386/load1-nacl.d
+++ b/ld/testsuite/ld-i386/load1-nacl.d
@@ -16,7 +16,7 @@ SYMBOL TABLE:
Disassembly of section .text:
0+20000 <_start>:
-[ ]*[a-f0-9]+: 8d 05 80 00 03 10 lea 0x10030080,%eax
+[ ]*[a-f0-9]+: c7 c0 80 00 03 10 mov \$0x10030080,%eax
[ ]*[a-f0-9]+: 81 d0 80 00 03 10 adc \$0x10030080,%eax
[ ]*[a-f0-9]+: 81 c3 80 00 03 10 add \$0x10030080,%ebx
[ ]*[a-f0-9]+: 81 e1 80 00 03 10 and \$0x10030080,%ecx
@@ -26,7 +26,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 80 00 03 10 sub \$0x10030080,%ebp
[ ]*[a-f0-9]+: 81 f4 80 00 03 10 xor \$0x10030080,%esp
[ ]*[a-f0-9]+: f7 c1 80 00 03 10 test \$0x10030080,%ecx
-[ ]*[a-f0-9]+: 8d 05 80 00 03 10 lea 0x10030080,%eax
+[ ]*[a-f0-9]+: c7 c0 80 00 03 10 mov \$0x10030080,%eax
[ ]*[a-f0-9]+: 81 d0 80 00 03 10 adc \$0x10030080,%eax
[ ]*[a-f0-9]+: 81 c3 80 00 03 10 add \$0x10030080,%ebx
[ ]*[a-f0-9]+: 81 e1 80 00 03 10 and \$0x10030080,%ecx
@@ -36,7 +36,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 80 00 03 10 sub \$0x10030080,%ebp
[ ]*[a-f0-9]+: 81 f4 80 00 03 10 xor \$0x10030080,%esp
[ ]*[a-f0-9]+: f7 c1 80 00 03 10 test \$0x10030080,%ecx
-[ ]*[a-f0-9]+: 8d 05 81 00 03 10 lea 0x10030081,%eax
+[ ]*[a-f0-9]+: c7 c0 81 00 03 10 mov \$0x10030081,%eax
[ ]*[a-f0-9]+: 81 d0 81 00 03 10 adc \$0x10030081,%eax
[ ]*[a-f0-9]+: 81 c3 81 00 03 10 add \$0x10030081,%ebx
[ ]*[a-f0-9]+: 81 e1 81 00 03 10 and \$0x10030081,%ecx
@@ -46,7 +46,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 81 00 03 10 sub \$0x10030081,%ebp
[ ]*[a-f0-9]+: 81 f4 81 00 03 10 xor \$0x10030081,%esp
[ ]*[a-f0-9]+: f7 c1 81 00 03 10 test \$0x10030081,%ecx
-[ ]*[a-f0-9]+: 8d 05 81 00 03 10 lea 0x10030081,%eax
+[ ]*[a-f0-9]+: c7 c0 81 00 03 10 mov \$0x10030081,%eax
[ ]*[a-f0-9]+: 81 d0 81 00 03 10 adc \$0x10030081,%eax
[ ]*[a-f0-9]+: 81 c3 81 00 03 10 add \$0x10030081,%ebx
[ ]*[a-f0-9]+: 81 e1 81 00 03 10 and \$0x10030081,%ecx
diff --git a/ld/testsuite/ld-i386/load1.d b/ld/testsuite/ld-i386/load1.d
index a252a15efa2..9c4aa8e164e 100644
--- a/ld/testsuite/ld-i386/load1.d
+++ b/ld/testsuite/ld-i386/load1.d
@@ -15,7 +15,7 @@ SYMBOL TABLE:
Disassembly of section .text:
0+8048074 <_start>:
-[ ]*[a-f0-9]+: 8d 05 70 91 04 08 lea 0x8049170,%eax
+[ ]*[a-f0-9]+: c7 c0 70 91 04 08 mov \$0x8049170,%eax
[ ]*[a-f0-9]+: 81 d0 70 91 04 08 adc \$0x8049170,%eax
[ ]*[a-f0-9]+: 81 c3 70 91 04 08 add \$0x8049170,%ebx
[ ]*[a-f0-9]+: 81 e1 70 91 04 08 and \$0x8049170,%ecx
@@ -25,7 +25,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 70 91 04 08 sub \$0x8049170,%ebp
[ ]*[a-f0-9]+: 81 f4 70 91 04 08 xor \$0x8049170,%esp
[ ]*[a-f0-9]+: f7 c1 70 91 04 08 test \$0x8049170,%ecx
-[ ]*[a-f0-9]+: 8d 05 70 91 04 08 lea 0x8049170,%eax
+[ ]*[a-f0-9]+: c7 c0 70 91 04 08 mov \$0x8049170,%eax
[ ]*[a-f0-9]+: 81 d0 70 91 04 08 adc \$0x8049170,%eax
[ ]*[a-f0-9]+: 81 c3 70 91 04 08 add \$0x8049170,%ebx
[ ]*[a-f0-9]+: 81 e1 70 91 04 08 and \$0x8049170,%ecx
@@ -35,7 +35,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 70 91 04 08 sub \$0x8049170,%ebp
[ ]*[a-f0-9]+: 81 f4 70 91 04 08 xor \$0x8049170,%esp
[ ]*[a-f0-9]+: f7 c1 70 91 04 08 test \$0x8049170,%ecx
-[ ]*[a-f0-9]+: 8d 05 71 91 04 08 lea 0x8049171,%eax
+[ ]*[a-f0-9]+: c7 c0 71 91 04 08 mov \$0x8049171,%eax
[ ]*[a-f0-9]+: 81 d0 71 91 04 08 adc \$0x8049171,%eax
[ ]*[a-f0-9]+: 81 c3 71 91 04 08 add \$0x8049171,%ebx
[ ]*[a-f0-9]+: 81 e1 71 91 04 08 and \$0x8049171,%ecx
@@ -45,7 +45,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 81 ed 71 91 04 08 sub \$0x8049171,%ebp
[ ]*[a-f0-9]+: 81 f4 71 91 04 08 xor \$0x8049171,%esp
[ ]*[a-f0-9]+: f7 c1 71 91 04 08 test \$0x8049171,%ecx
-[ ]*[a-f0-9]+: 8d 05 71 91 04 08 lea 0x8049171,%eax
+[ ]*[a-f0-9]+: c7 c0 71 91 04 08 mov \$0x8049171,%eax
[ ]*[a-f0-9]+: 81 d0 71 91 04 08 adc \$0x8049171,%eax
[ ]*[a-f0-9]+: 81 c3 71 91 04 08 add \$0x8049171,%ebx
[ ]*[a-f0-9]+: 81 e1 71 91 04 08 and \$0x8049171,%ecx
diff --git a/ld/testsuite/ld-i386/load4b.d b/ld/testsuite/ld-i386/load4b.d
index 0f6f4e27e5d..9d1732b40f3 100644
--- a/ld/testsuite/ld-i386/load4b.d
+++ b/ld/testsuite/ld-i386/load4b.d
@@ -9,5 +9,5 @@
Disassembly of section .text:
#...
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
#pass
diff --git a/ld/testsuite/ld-i386/load5b.d b/ld/testsuite/ld-i386/load5b.d
index 6db0b2839f2..96726a452dc 100644
--- a/ld/testsuite/ld-i386/load5b.d
+++ b/ld/testsuite/ld-i386/load5b.d
@@ -9,5 +9,5 @@
Disassembly of section .text:
#...
-[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax
+[ ]*[a-f0-9]+: c7 c0 ([0-9a-f]{2} ){4} * mov \$0x[a-f0-9]+,%eax
#pass
diff --git a/ld/testsuite/ld-i386/mov1b.d b/ld/testsuite/ld-i386/mov1b.d
index ae40862384e..1b7cc2fa727 100644
--- a/ld/testsuite/ld-i386/mov1b.d
+++ b/ld/testsuite/ld-i386/mov1b.d
@@ -1,6 +1,6 @@
#source: mov1.s
#as: --32
-#ld: -pie -melf_i386
+#ld: -pie -melf_i386 --no-dynamic-linker
#objdump: -dw
.*: +file format .*
@@ -10,6 +10,6 @@ Disassembly of section .text:
#...
[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax
-[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax
-[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 * mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 * mov \$0x0,%eax
#pass
diff --git a/ld/testsuite/ld-i386/pr19609-1.s b/ld/testsuite/ld-i386/pr19609-1.s
new file mode 100644
index 00000000000..f0b8eac307f
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1.s
@@ -0,0 +1,12 @@
+ .text
+ .weak bar
+ .globl _start
+ .type _start, @function
+_start:
+ cmp bar@GOT(%edx), %eax
+ cmp bar@GOT(%edx), %ecx
+ mov bar@GOT(%edx), %eax
+ mov bar@GOT(%edx), %ecx
+ test bar@GOT(%edx), %eax
+ test bar@GOT(%edx), %ecx
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-i386/pr19609-1a.d b/ld/testsuite/ld-i386/pr19609-1a.d
new file mode 100644
index 00000000000..214adaf53d0
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1a.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1b.d b/ld/testsuite/ld-i386/pr19609-1b.d
new file mode 100644
index 00000000000..ebd6bc9a633
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1b.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1c.d b/ld/testsuite/ld-i386/pr19609-1c.d
new file mode 100644
index 00000000000..e7d1c134ce6
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1c.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 3b 82 fc ff ff ff cmp -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 3b 8a fc ff ff ff cmp -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 8b 82 fc ff ff ff mov -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 8b 8a fc ff ff ff mov -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 85 82 fc ff ff ff test %eax,-0x4\(%edx\)
+[ ]*[a-f0-9]+: 85 8a fc ff ff ff test %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-1d.d b/ld/testsuite/ld-i386/pr19609-1d.d
new file mode 100644
index 00000000000..4b50f8c0e15
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1d.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -E -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1e.d b/ld/testsuite/ld-i386/pr19609-1e.d
new file mode 100644
index 00000000000..a515ad6c897
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1e.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -E -Bsymbolic -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 3b 82 fc ff ff ff cmp -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 3b 8a fc ff ff ff cmp -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 8b 82 fc ff ff ff mov -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 8b 8a fc ff ff ff mov -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: 85 82 fc ff ff ff test %eax,-0x4\(%edx\)
+[ ]*[a-f0-9]+: 85 8a fc ff ff ff test %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-1f.d b/ld/testsuite/ld-i386/pr19609-1f.d
new file mode 100644
index 00000000000..99ed5bbf466
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1f.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie --dynamic-list-data -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1g.d b/ld/testsuite/ld-i386/pr19609-1g.d
new file mode 100644
index 00000000000..2fc97316e03
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1g.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -E -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1h.d b/ld/testsuite/ld-i386/pr19609-1h.d
new file mode 100644
index 00000000000..79fe5d5900c
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1h.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -E -Bsymbolic-functions -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 81 f8 00 00 00 00 cmp \$0x0,%eax
+[ ]*[a-f0-9]+: 81 f9 00 00 00 00 cmp \$0x0,%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: f7 c0 00 00 00 00 test \$0x0,%eax
+[ ]*[a-f0-9]+: f7 c1 00 00 00 00 test \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1i.d b/ld/testsuite/ld-i386/pr19609-1i.d
new file mode 100644
index 00000000000..ce15bc90e11
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-1i.d
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=no
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: 3b 82 fc ff ff ff cmp -0x4\(%edx\),%eax
+[ ]*[a-f0-9]+: 3b 8a fc ff ff ff cmp -0x4\(%edx\),%ecx
+[ ]*[a-f0-9]+: c7 c0 00 00 00 00 mov \$0x0,%eax
+[ ]*[a-f0-9]+: c7 c1 00 00 00 00 mov \$0x0,%ecx
+[ ]*[a-f0-9]+: 85 82 fc ff ff ff test %eax,-0x4\(%edx\)
+[ ]*[a-f0-9]+: 85 8a fc ff ff ff test %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-2.s b/ld/testsuite/ld-i386/pr19609-2.s
new file mode 100644
index 00000000000..622dbd4d1cc
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-2.s
@@ -0,0 +1,6 @@
+ .text
+ .weak bar
+ .globl _start
+ .type _start, @function
+_start:
+ call *bar@GOT(%edx)
diff --git a/ld/testsuite/ld-i386/pr19609-2a.d b/ld/testsuite/ld-i386/pr19609-2a.d
new file mode 100644
index 00000000000..ea1e4611ca7
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-2a.d
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[ ]+addr16 call 0 <_start-0x[0-9a-f]+>
diff --git a/ld/testsuite/ld-i386/pr19609-2b.d b/ld/testsuite/ld-i386/pr19609-2b.d
new file mode 100644
index 00000000000..a4bf5981ef2
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-2b.d
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: ff 92 fc ff ff ff call \*-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-2c.d b/ld/testsuite/ld-i386/pr19609-2c.d
new file mode 100644
index 00000000000..2553f8a7ef0
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr19609-2c.d
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: ff 92 fc ff ff ff call \*-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/undefweak.s b/ld/testsuite/ld-i386/undefweak.s
new file mode 100644
index 00000000000..f34c917d79b
--- /dev/null
+++ b/ld/testsuite/ld-i386/undefweak.s
@@ -0,0 +1,10 @@
+ .text
+ .globl _start
+_start:
+ mov .Ljmp(%eax), %eax
+ jmp *(%eax)
+ .section .data.rel.ro.local,"aw",@progbits
+ .weak func
+ .align 8
+.Ljmp:
+ .long func
diff --git a/ld/testsuite/ld-i386/undefweaka.d b/ld/testsuite/ld-i386/undefweaka.d
new file mode 100644
index 00000000000..c106ebf54f0
--- /dev/null
+++ b/ld/testsuite/ld-i386/undefweaka.d
@@ -0,0 +1,9 @@
+#source: undefweak.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +[0-9a-f]+ +func
diff --git a/ld/testsuite/ld-i386/undefweakb.d b/ld/testsuite/ld-i386/undefweakb.d
new file mode 100644
index 00000000000..48ebad8843d
--- /dev/null
+++ b/ld/testsuite/ld-i386/undefweakb.d
@@ -0,0 +1,11 @@
+#source: undefweak.s
+#as: --32
+#ld: -pie -melf_i386
+#readelf: -r --wide -x .data.rel.ro
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+
+Hex dump of section '.data.rel.ro':
+ 0x[a-f0-9]+ 00000000 ....