diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-01-12 05:10:58 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-01-12 05:19:24 -0800 |
commit | c2e9a4a3ed1efcbdec68372e7e889470870d6d48 (patch) | |
tree | 9b22646128b83942d9b39477d5fd607580736c0c /bfd/reloc.c | |
parent | 6d104cac0a03be6f005cef9da37ed39cc49cce5c (diff) | |
download | gdb-c2e9a4a3ed1efcbdec68372e7e889470870d6d48.zip gdb-c2e9a4a3ed1efcbdec68372e7e889470870d6d48.tar.gz gdb-c2e9a4a3ed1efcbdec68372e7e889470870d6d48.tar.bz2 |
elf/x86-64: Adjust R_AMD64_DIR64/R_AMD64_DIR32 for PE/x86-64 inputs
Subtract the value of the section contents for R_AMD64_DIR64 and
R_AMD64_DIR32 relocations when generating ELF output from PE/x86-64
inputs.
bfd/
PR ld/27171
* reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
R_AMD64_DIR32 relocations for PE/x86-64 inputs.
ld/
PR ld/27171
* testsuite/ld-x86-64/pe-x86-64-5.obj.bz2: New file.
* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Run PR ld/27171 test.
Diffstat (limited to 'bfd/reloc.c')
-rw-r--r-- | bfd/reloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c index 46c996f..4f4b95a 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -921,6 +921,13 @@ space consuming. For each target: if (howto->type >= R_AMD64_PCRLONG_1 && howto->type <= R_AMD64_PCRLONG_5) relocation -= (bfd_vma)(howto->type - R_AMD64_PCRLONG); + else if (howto->type == R_AMD64_DIR64 + || howto->type == R_AMD64_DIR32) + { + bfd_vma val = read_reloc (abfd, (bfd_byte *) data + octets, + howto); + relocation -= val & howto->src_mask; + } } /* FIXME: This overflow checking is incomplete, because the value |