aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2017-11-23 11:02:30 +0100
committerJan Beulich <jbeulich@suse.com>2017-11-23 11:02:30 +0100
commit43083a502b8d658b8d096111e54afcc73b0215a4 (patch)
tree0695c73e2bf6e60e243e0afcc023c7ef8fb96359 /ld
parent9bb129e82f0506fe78d61670ea2b4140388955dd (diff)
downloadfsf-binutils-gdb-43083a502b8d658b8d096111e54afcc73b0215a4.zip
fsf-binutils-gdb-43083a502b8d658b8d096111e54afcc73b0215a4.tar.gz
fsf-binutils-gdb-43083a502b8d658b8d096111e54afcc73b0215a4.tar.bz2
x86-64: always use unsigned 32-bit reloc for 32-bit addressing w/o base reg
Except for %eip-relative addressing, where we don't have a suitable relocation type silently wrapping at the 4G boundary, consistently force use of R_X86_64_32 (in ELF terms) instead of its sign-extending counterpart. This wasn't right in case there was no base register in the addressing expression.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-x86-64/apic.d18
-rw-r--r--ld/testsuite/ld-x86-64/apic.s13
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
4 files changed, 38 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4cfcf6d..6ec3260 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-23 Jan Beulich <jbeulich@suse.com>
+
+ PR gas/22441
+ * testsuite/ld-x86-64/apic.{s,d}: New.
+ * testsuite/ld-x86-64/x86-64.exp: Run new test.
+
2017-11-21 Nick Clifton <nickc@redhat.com>
PR 22419
diff --git a/ld/testsuite/ld-x86-64/apic.d b/ld/testsuite/ld-x86-64/apic.d
new file mode 100644
index 0000000..782c6fa
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/apic.d
@@ -0,0 +1,18 @@
+#name: 32-bit relocs w/ index but no base
+#ld: --defsym APIC_BASE=0xfee00000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section \.text:
+
+#...
+[0-9a-f]+[ ]+<apic_read>:
+[ ]*[0-9a-f]+:[ ]+67 8b 04 bd 00 00 e0 fe[ ]+mov[ ]+(0xfee|-0x12)00000\(,%edi,4\),%eax
+[ ]*[0-9a-f]+:[ ]+c3[ ]+retq?[ ]*
+#...
+[0-9a-f]+[ ]+<apic_write>:
+[ ]*[0-9a-f]+:[ ]+67 89 34 bd 00 00 e0 fe[ ]+mov[ ]+%esi,(0xfee|-0x12)00000\(,%edi,4\)
+[ ]*[0-9a-f]+:[ ]+c3[ ]+retq?[ ]*
+#pass
diff --git a/ld/testsuite/ld-x86-64/apic.s b/ld/testsuite/ld-x86-64/apic.s
new file mode 100644
index 0000000..d500799
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/apic.s
@@ -0,0 +1,13 @@
+ .text
+ .intel_syntax noprefix
+ .global _start
+_start:
+ ret
+
+apic_read:
+ mov eax, [edi*4+APIC_BASE]
+ ret
+
+apic_write:
+ mov [edi*4+APIC_BASE], esi
+ ret
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ef2cb15..e58d7c8 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -267,6 +267,7 @@ if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] }
run_dump_test "abs"
run_dump_test "abs-l1om"
+run_dump_test "apic"
run_dump_test "pcrel8"
run_dump_test "pcrel16"
run_dump_test "tlsgd2"