aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-x86-64
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-x86-64')
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1.t1
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1a.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1a.s4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1b.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1b.s2
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1c.d7
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1c.s3
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1d.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1e.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1f.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1g.d7
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1h.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1i.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1j.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1k.d7
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1l.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1m.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1n.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1o.d7
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1p.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1q.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1r.d5
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1s.d8
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1t.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1u.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1v.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1w.d6
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1x.d13
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-1y.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-2.s4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-2a.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-2b.d5
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-2c.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-2d.d5
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-3.s4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-3a.d8
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-3b.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-3c.d8
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-3d.d9
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-4.s5
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-4a.d5
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-4b.d14
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-5.s8
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-5a.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19818-5b.d4
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp37
46 files changed, 375 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr19818-1.t b/ld/testsuite/ld-x86-64/pr19818-1.t
new file mode 100644
index 0000000..591940b
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1.t
@@ -0,0 +1 @@
+foo = 0xffffffff;
diff --git a/ld/testsuite/ld-x86-64/pr19818-1a.d b/ld/testsuite/ld-x86-64/pr19818-1a.d
new file mode 100644
index 0000000..96a72c7
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1a.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -m elf_x86_64 --defsym foo=0xffffffff
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1a.s b/ld/testsuite/ld-x86-64/pr19818-1a.s
new file mode 100644
index 0000000..df03cd1
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1a.s
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ movl $foo, %eax
diff --git a/ld/testsuite/ld-x86-64/pr19818-1b.d b/ld/testsuite/ld-x86-64/pr19818-1b.d
new file mode 100644
index 0000000..5b9fbef
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1b.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -m elf_x86_64 --defsym foo=0xffffffff
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1b.s b/ld/testsuite/ld-x86-64/pr19818-1b.s
new file mode 100644
index 0000000..6f37759
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1b.s
@@ -0,0 +1,2 @@
+ .globl foo
+ foo = 0xffffffff
diff --git a/ld/testsuite/ld-x86-64/pr19818-1c.d b/ld/testsuite/ld-x86-64/pr19818-1c.d
new file mode 100644
index 0000000..90d6a3c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1c.d
@@ -0,0 +1,7 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --64
+#ld: -pie -m elf_x86_64
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1c.s b/ld/testsuite/ld-x86-64/pr19818-1c.s
new file mode 100644
index 0000000..5cdf8b9
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1c.s
@@ -0,0 +1,3 @@
+ .globl foo
+ .hidden foo
+ foo = 0xffffffff
diff --git a/ld/testsuite/ld-x86-64/pr19818-1d.d b/ld/testsuite/ld-x86-64/pr19818-1d.d
new file mode 100644
index 0000000..63b65af
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1d.d
@@ -0,0 +1,14 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --64
+#ld: -pie -m elf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1e.d b/ld/testsuite/ld-x86-64/pr19818-1e.d
new file mode 100644
index 0000000..2e693c1
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1e.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -pie -m elf32_x86_64 --defsym foo=0xffffffff
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1f.d b/ld/testsuite/ld-x86-64/pr19818-1f.d
new file mode 100644
index 0000000..afc3ec7
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1f.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -pie -m elf32_x86_64 --defsym foo=0xffffffff
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1g.d b/ld/testsuite/ld-x86-64/pr19818-1g.d
new file mode 100644
index 0000000..ef9a482
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1g.d
@@ -0,0 +1,7 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --x32
+#ld: -pie -m elf32_x86_64
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1h.d b/ld/testsuite/ld-x86-64/pr19818-1h.d
new file mode 100644
index 0000000..7f591eb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1h.d
@@ -0,0 +1,14 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --x32
+#ld: -pie -m elf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1i.d b/ld/testsuite/ld-x86-64/pr19818-1i.d
new file mode 100644
index 0000000..cf1a226
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1i.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -shared -Bsymbolic -m elf_x86_64 --defsym foo=0xffffffff
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1j.d b/ld/testsuite/ld-x86-64/pr19818-1j.d
new file mode 100644
index 0000000..9174c03
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1j.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -shared -Bsymbolic -m elf_x86_64 --defsym foo=0xffffffff
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1k.d b/ld/testsuite/ld-x86-64/pr19818-1k.d
new file mode 100644
index 0000000..d61f964
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1k.d
@@ -0,0 +1,7 @@
+#source: pr19818-1a.s
+#source: pr19818-1c.s
+#as: --64
+#ld: -shared -m elf_x86_64
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1l.d b/ld/testsuite/ld-x86-64/pr19818-1l.d
new file mode 100644
index 0000000..bea7f2f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1l.d
@@ -0,0 +1,14 @@
+#source: pr19818-1a.s
+#source: pr19818-1c.s
+#as: --64
+#ld: -shared -m elf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1m.d b/ld/testsuite/ld-x86-64/pr19818-1m.d
new file mode 100644
index 0000000..e95b9f4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1m.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -shared -Bsymbolic -m elf32_x86_64 --defsym foo=0xffffffff
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1n.d b/ld/testsuite/ld-x86-64/pr19818-1n.d
new file mode 100644
index 0000000..33e7b32
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1n.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -shared -Bsymbolic -m elf32_x86_64 --defsym foo=0xffffffff
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1o.d b/ld/testsuite/ld-x86-64/pr19818-1o.d
new file mode 100644
index 0000000..7470234
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1o.d
@@ -0,0 +1,7 @@
+#source: pr19818-1a.s
+#source: pr19818-1c.s
+#as: --x32
+#ld: -shared -m elf32_x86_64
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1p.d b/ld/testsuite/ld-x86-64/pr19818-1p.d
new file mode 100644
index 0000000..40d7ff6
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1p.d
@@ -0,0 +1,14 @@
+#source: pr19818-1a.s
+#source: pr19818-1c.s
+#as: --x32
+#ld: -shared -m elf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1q.d b/ld/testsuite/ld-x86-64/pr19818-1q.d
new file mode 100644
index 0000000..28b4c09
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1q.d
@@ -0,0 +1,4 @@
+#source: pr19818-1a.s
+#as: --64 -mrelax-relocations=no
+#ld: -shared -m elf_x86_64 --defsym foo=0xffffffff
+#error: .*relocation R_X86_64_32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-1r.d b/ld/testsuite/ld-x86-64/pr19818-1r.d
new file mode 100644
index 0000000..de68580
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1r.d
@@ -0,0 +1,5 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --64 -mrelax-relocations=no
+#ld: -shared -m elf_x86_64
+#error: .*relocation R_X86_64_32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-1s.d b/ld/testsuite/ld-x86-64/pr19818-1s.d
new file mode 100644
index 0000000..fc27a50
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1s.d
@@ -0,0 +1,8 @@
+#source: pr19818-1a.s
+#as: --x32 -mrelax-relocations=no
+#ld: -shared -m elf32_x86_64 --defsym foo=0xffffffff -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-1t.d b/ld/testsuite/ld-x86-64/pr19818-1t.d
new file mode 100644
index 0000000..19d775a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1t.d
@@ -0,0 +1,9 @@
+#source: pr19818-1a.s
+#source: pr19818-1b.s
+#as: --x32 -mrelax-relocations=no
+#ld: -shared -m elf32_x86_64 -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-1u.d b/ld/testsuite/ld-x86-64/pr19818-1u.d
new file mode 100644
index 0000000..b6155ca
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1u.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -m elf_x86_64 -T pr19818-1.t
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1v.d b/ld/testsuite/ld-x86-64/pr19818-1v.d
new file mode 100644
index 0000000..6ff6046
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1v.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -m elf_x86_64 -T pr19818-1.t
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1w.d b/ld/testsuite/ld-x86-64/pr19818-1w.d
new file mode 100644
index 0000000..aa8028e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1w.d
@@ -0,0 +1,6 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -pie -m elf32_x86_64 -T pr19818-1.t
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-x86-64/pr19818-1x.d b/ld/testsuite/ld-x86-64/pr19818-1x.d
new file mode 100644
index 0000000..ce043aa
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1x.d
@@ -0,0 +1,13 @@
+#source: pr19818-1a.s
+#as: --x32
+#ld: -pie -m elf32_x86_64 -T pr19818-1.t
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ff ff ff ff mov \$0xffffffff,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-1y.d b/ld/testsuite/ld-x86-64/pr19818-1y.d
new file mode 100644
index 0000000..aac2e11
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-1y.d
@@ -0,0 +1,4 @@
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -melf_x86_64 --defsym foo=0x100000000
+#error: .*relocation truncated to fit: R_X86_64_32 .*
diff --git a/ld/testsuite/ld-x86-64/pr19818-2.s b/ld/testsuite/ld-x86-64/pr19818-2.s
new file mode 100644
index 0000000..d9541ff
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-2.s
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ leal foo(%rip), %eax
diff --git a/ld/testsuite/ld-x86-64/pr19818-2a.d b/ld/testsuite/ld-x86-64/pr19818-2a.d
new file mode 100644
index 0000000..5ba6b0e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-2a.d
@@ -0,0 +1,4 @@
+#source: pr19818-2.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -m elf_x86_64 --defsym foo=0xffffffff
+#error: .*relocation R_X86_64_PC32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-2b.d b/ld/testsuite/ld-x86-64/pr19818-2b.d
new file mode 100644
index 0000000..5e044c4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-2b.d
@@ -0,0 +1,5 @@
+#source: pr19818-2.s
+#source: pr19818-1b.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -m elf_x86_64
+#error: .*relocation R_X86_64_PC32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-2c.d b/ld/testsuite/ld-x86-64/pr19818-2c.d
new file mode 100644
index 0000000..4dc13a2
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-2c.d
@@ -0,0 +1,4 @@
+#source: pr19818-2.s
+#as: --x32 -mrelax-relocations=no
+#ld: -pie -m elf32_x86_64 --defsym foo=0xffffffff
+#error: .*relocation R_X86_64_PC32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-2d.d b/ld/testsuite/ld-x86-64/pr19818-2d.d
new file mode 100644
index 0000000..e518ae3
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-2d.d
@@ -0,0 +1,5 @@
+#source: pr19818-2.s
+#source: pr19818-1b.s
+#as: --x32 -mrelax-relocations=no
+#ld: -pie -m elf32_x86_64
+#error: .*relocation R_X86_64_PC32 against absolute symbol `foo' can not be used when making a shared object
diff --git a/ld/testsuite/ld-x86-64/pr19818-3.s b/ld/testsuite/ld-x86-64/pr19818-3.s
new file mode 100644
index 0000000..d3b0660
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-3.s
@@ -0,0 +1,4 @@
+ .text
+ .global _start
+_start:
+ movabs $foo, %rax
diff --git a/ld/testsuite/ld-x86-64/pr19818-3a.d b/ld/testsuite/ld-x86-64/pr19818-3a.d
new file mode 100644
index 0000000..8031a03
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-3a.d
@@ -0,0 +1,8 @@
+#source: pr19818-3.s
+#as: --64 -mrelax-relocations=no
+#ld: -shared -m elf_x86_64 --defsym foo=0xffffffff -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-3b.d b/ld/testsuite/ld-x86-64/pr19818-3b.d
new file mode 100644
index 0000000..0059a8c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-3b.d
@@ -0,0 +1,9 @@
+#source: pr19818-3.s
+#source: pr19818-1b.s
+#as: --64 -mrelax-relocations=no
+#ld: -shared -m elf_x86_64 -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +0+ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-3c.d b/ld/testsuite/ld-x86-64/pr19818-3c.d
new file mode 100644
index 0000000..c940773
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-3c.d
@@ -0,0 +1,8 @@
+#source: pr19818-3.s
+#as: --x32 -mrelax-relocations=no
+#ld: -shared -m elf32_x86_64 --defsym foo=0xffffffff -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-3d.d b/ld/testsuite/ld-x86-64/pr19818-3d.d
new file mode 100644
index 0000000..cc7e79b
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-3d.d
@@ -0,0 +1,9 @@
+#source: pr19818-3.s
+#source: pr19818-1b.s
+#as: --x32 -mrelax-relocations=no
+#ld: -shared -m elf32_x86_64 -z nocombreloc
+#readelf: -r --wide
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +ffffffff +foo \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-4.s b/ld/testsuite/ld-x86-64/pr19818-4.s
new file mode 100644
index 0000000..486ba0f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-4.s
@@ -0,0 +1,5 @@
+ .globl foo
+ .type foo, @object
+ .data
+foo:
+ .long 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-4a.d b/ld/testsuite/ld-x86-64/pr19818-4a.d
new file mode 100644
index 0000000..1a48089
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-4a.d
@@ -0,0 +1,5 @@
+#source: pr19818-4.s
+#source: pr19818-1a.s
+#as: --64
+#ld: -pie -melf_x86_64
+#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a shared object; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/pr19818-4b.d b/ld/testsuite/ld-x86-64/pr19818-4b.d
new file mode 100644
index 0000000..b2c4763
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-4b.d
@@ -0,0 +1,14 @@
+#source: pr19818-4.s
+#source: pr19818-1a.s
+#as: --x32
+#ld: -pie -melf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: b8 ([0-9a-f]{2} ){4} mov \$0x[a-f0-9]+,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19818-5.s b/ld/testsuite/ld-x86-64/pr19818-5.s
new file mode 100644
index 0000000..0870f6a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-5.s
@@ -0,0 +1,8 @@
+ .globl _start
+ .type _start, @function
+_start:
+ movq $foo, %rax
+ .size _start, .-_start
+ .data
+foo:
+ .quad 0
diff --git a/ld/testsuite/ld-x86-64/pr19818-5a.d b/ld/testsuite/ld-x86-64/pr19818-5a.d
new file mode 100644
index 0000000..21df19c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-5a.d
@@ -0,0 +1,4 @@
+#source: pr19818-5.s
+#as: --64
+#ld: -pie -melf_x86_64
+#error: .*relocation R_X86_64_32S against symbol `.data' can not be used when making a shared object; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/pr19818-5b.d b/ld/testsuite/ld-x86-64/pr19818-5b.d
new file mode 100644
index 0000000..a30858e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr19818-5b.d
@@ -0,0 +1,4 @@
+#source: pr19818-5.s
+#as: --x32
+#ld: -pie -melf32_x86_64
+#error: .*relocation R_X86_64_32S against symbol `.data' can not be used when making a shared object; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 49f9fa3..3938597 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -247,6 +247,43 @@ run_dump_test "largecomm-1e"
run_dump_test "largecomm-1f"
run_dump_test "pr19539a"
run_dump_test "pr19539b"
+run_dump_test "pr19818-1a"
+run_dump_test "pr19818-1b"
+run_dump_test "pr19818-1c"
+run_dump_test "pr19818-1d"
+run_dump_test "pr19818-1e"
+run_dump_test "pr19818-1f"
+run_dump_test "pr19818-1g"
+run_dump_test "pr19818-1h"
+run_dump_test "pr19818-1i"
+run_dump_test "pr19818-1j"
+run_dump_test "pr19818-1k"
+run_dump_test "pr19818-1l"
+run_dump_test "pr19818-1m"
+run_dump_test "pr19818-1n"
+run_dump_test "pr19818-1o"
+run_dump_test "pr19818-1p"
+run_dump_test "pr19818-1q"
+run_dump_test "pr19818-1r"
+run_dump_test "pr19818-1s"
+run_dump_test "pr19818-1t"
+run_dump_test "pr19818-1u"
+run_dump_test "pr19818-1v"
+run_dump_test "pr19818-1w"
+run_dump_test "pr19818-1x"
+run_dump_test "pr19818-1y"
+run_dump_test "pr19818-2a"
+run_dump_test "pr19818-2b"
+run_dump_test "pr19818-2c"
+run_dump_test "pr19818-2d"
+run_dump_test "pr19818-3a"
+run_dump_test "pr19818-3b"
+run_dump_test "pr19818-3c"
+run_dump_test "pr19818-3d"
+run_dump_test "pr19818-4a"
+run_dump_test "pr19818-4b"
+run_dump_test "pr19818-5a"
+run_dump_test "pr19818-5b"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return