diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-05-07 12:05:12 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-05-07 12:05:12 +0200 |
commit | 17c6c3b99156fe82c1e637e1a5fd9f163ac788c8 (patch) | |
tree | 71c76cc1471f142456595eea8af28d3e1eadb1ee /gas/testsuite | |
parent | 98da05bf2698b55b73453480a3fbb92f163d2c7b (diff) | |
download | gdb-17c6c3b99156fe82c1e637e1a5fd9f163ac788c8.zip gdb-17c6c3b99156fe82c1e637e1a5fd9f163ac788c8.tar.gz 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 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/rela.d | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/rela.s | 14 |
3 files changed, 28 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 234438e..39010bd 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -1246,6 +1246,7 @@ if [gas_64_check] then { run_dump_test "reloc64" run_list_test "reloc64" "--defsym _bad_=1" run_dump_test "mixed-mode-reloc64" + run_dump_test "rela" run_dump_test "x86-64-ifunc" run_dump_test "x86-64-opcode-inval" run_dump_test "x86-64-opcode-inval-intel" diff --git a/gas/testsuite/gas/i386/rela.d b/gas/testsuite/gas/i386/rela.d new file mode 100644 index 0000000..198f712 --- /dev/null +++ b/gas/testsuite/gas/i386/rela.d @@ -0,0 +1,13 @@ +#name: x86-64 rela relocs w/ non-zero relocated fields +#objdump: -rsj .data + +.*: +file format .* + +RELOCATION RECORDS FOR \[\.data\]: + +OFFSET +TYPE +VALUE * +0*0 R_X86_64_64 *q +0*8 R_X86_64_32 *l + +Contents of section .data: + 0+0 11 ?11 ?11 ?11 22 ?22 ?22 ?22 33 ?33 ?33 ?33 44 ?44 ?44 ?44 .* diff --git a/gas/testsuite/gas/i386/rela.s b/gas/testsuite/gas/i386/rela.s new file mode 100644 index 0000000..28269fe --- /dev/null +++ b/gas/testsuite/gas/i386/rela.s @@ -0,0 +1,14 @@ +# Note: This file is also used by an ld test case. + + .text + .global _start +_start: + ret + + .data + .p2align 4 +l: .long 0x11111111, 0x22222222 +q: .quad 0x4444444433333333 + + .reloc l, BFD_RELOC_64, q + .reloc q, BFD_RELOC_32, l |