elf/x86-64: Adjust relocation for PE/x86-64 inputs
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 16 Sep 2020 14:11:16 +0000 (07:11 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 16 Sep 2020 14:11:31 +0000 (07:11 -0700)
commit36068e2fa5460e6cfa1f5f359df6f37c497aab50
tree9852e7ae898e51e89bb77fbab30606d76c6acf74
parent337882d477675296a22fd8c1f7412ca30c70d9b0
elf/x86-64: Adjust relocation for PE/x86-64 inputs

PE linker calls _bfd_relocate_contents to resolve relocation, instead of
bfd_perform_relocation.  But ELF linker calls bfd_perform_relocation, not
_bfd_relocate_contents.  When linking PE/x86-64 inputs to generate ELF
output, we need to adjust PE/x86-64 relocations in bfd_perform_relocation.

Enable PE/x86-64 in bfd together with PEI/x86-64.  Update run_ld_link_tests
to handle bzip2 binary inputs.

bfd/

PR ld/26583
* config.bfd (targ64_selvecs, targ_selvecs): Add x86_64_pe_vec
to x86_64_pei_vec.
* reloc.c: Include "coff/internal.h".
(bfd_perform_relocation): Adjust relocation for PE/x86-64 inputs.

ld/

PR ld/26583
* testsuite/ld-x86-64/pe-x86-64-1.od: New file.
* testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Likewise.
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Handle bz2 binary
inputs.
24 files changed:
bfd/ChangeLog
bfd/config.bfd
bfd/reloc.c
ld/ChangeLog
ld/testsuite/ld-x86-64/pe-x86-64-1.od [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-1a.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-1b.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-1c.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-2.od [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-2a.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-2b.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-2c.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-3.od [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-3a.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-3b.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-3c.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-3d.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-4.od [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-4a.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-4b.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-4c.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64-4d.obj.bz2 [new file with mode: 0644]
ld/testsuite/ld-x86-64/pe-x86-64.exp [new file with mode: 0644]
ld/testsuite/lib/ld-lib.exp