aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-05-07 12:05:12 +0200
committerJan Beulich <jbeulich@suse.com>2021-05-07 12:05:12 +0200
commit17c6c3b99156fe82c1e637e1a5fd9f163ac788c8 (patch)
tree71c76cc1471f142456595eea8af28d3e1eadb1ee /ld
parent98da05bf2698b55b73453480a3fbb92f163d2c7b (diff)
downloadfsf-binutils-gdb-17c6c3b99156fe82c1e637e1a5fd9f163ac788c8.zip
fsf-binutils-gdb-17c6c3b99156fe82c1e637e1a5fd9f163ac788c8.tar.gz
fsf-binutils-gdb-17c6c3b99156fe82c1e637e1a5fd9f163ac788c8.tar.bz2
x86-64/ELF: clear src_mask for all reloc types
x86-64 uses rela relocations. The comment next to the field's declaration says "Non-zero values for ELF USE_RELA targets should be viewed with suspicion ..." And indeed the fields being non-zero causes section contents to be accumulated into the final relocated values in addition to the relocations' addends, which is contrary to the ELF spec.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/testsuite/ld-x86-64/rela.d10
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
3 files changed, 16 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 998c403..d78c706 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-07 Jan Beulich <jbeulich@suse.com>
+
+ * testsuite/ld-x86-64/rela.d: New.
+ * testsuite/ld-x86-64/x86-64.exp: Run new test.
+
2021-05-07 Nick Clifton <nickc@redhat.com>
* ldelfgen.c (compare_link_order): Ignore section size when
diff --git a/ld/testsuite/ld-x86-64/rela.d b/ld/testsuite/ld-x86-64/rela.d
new file mode 100644
index 0000000..ac91834
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/rela.d
@@ -0,0 +1,10 @@
+#name: x86-64 rela relocs w/ non-zero relocated fields
+#as: --64
+#source: ${srcdir}/../../../gas/testsuite/gas/i386/rela.s
+#ld: -melf_x86_64
+#objdump: -sj .data
+
+.*: +file format .*
+
+Contents of section .data:
+ *[0-9a-f]*0 08 ?.. ?.. ?.. 00 ?00 ?00 ?00 00 ?.. ?.. ?.. 44 ?44 ?44 ?44 .*
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 269f70d..17fd10e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -262,6 +262,7 @@ run_dump_test "apic"
run_dump_test "pcrel8"
run_dump_test "pcrel16"
run_dump_test "pcrel16-2"
+run_dump_test "rela"
run_dump_test "tlsgd2"
run_dump_test "tlsgd3"
run_dump_test "tlsgd12"