]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
bpf: relocation fixes for eBPF ELF backend
authorJose E. Marchesi <jose.marchesi@oracle.com>
Wed, 12 Aug 2020 13:41:34 +0000 (15:41 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Wed, 12 Aug 2020 13:41:34 +0000 (15:41 +0200)
commit9478b1cc9449177f11aedd68f31472e8dc18f058
tree436f44bb7bf7c0985157b61d4b9990656572aac0
parent6ef598a264412c7ca1d44de3aa2eafff5213c9ab
bpf: relocation fixes for eBPF ELF backend

The eBPF ELF backend was not properly recording relocation addends
during installation, nor reading and applying them when performing
the final relocation. This lead to various issues with incorrect
relocations.

These issues are fixed with a new howto special function to install
the relocations, and updates to bpf_elf_relocate_section to read and
use the addends as recorded in the input_bfd.

bfd/ChangeLog

2020-08-05  David Faust  <david.faust@oracle.com>

* elf64-bpf.c (bpf_elf_generic_reloc): New function.
(bpf_elf_howto_table): Use it here.
(bpf_elf_relocate_section): Use addends recorded in input_bfd for
instruction and data relocations.

ld/ChangeLog

2020-08-05  David Faust  <david.faust@oracle.com>

* testsuite/ld-bpf/call-2.s: New file.
* testsuite/ld-bpf/call-2.d: Likewise.
* testsuite/ld-bpf/reloc-data-be.d: Likewise.
* testsuite/ld-bpf/reloc-data-le.d: Likewise.
* testsuite/ld-bpf/reloc-data.s: Likewise.
* testsuite/ld-bpf/reloc-insn-external-be.d: Likewise.
* testsuite/ld-bpf/reloc-insn-external-le.d: Likewise.
* testsuite/ld-bpf/reloc-insn-external.s: Likewise.
* testsuite/ld-bpf/reloc-insn32-be.d: Likewise.
* testsuite/ld-bpf/reloc-insn32-le.d: Likewise.
* testsuite/ld-bpf/reloc-insn32.s: Likewise.
* testsuite/ld-bpf/reloc-insn64-be.d: Likewise.
* testsuite/ld-bpf/reloc-insn64-le.d: Likewise.
* testsuite/ld-bpf/reloc-insn64.s: Likewise.
17 files changed:
bfd/ChangeLog
bfd/elf64-bpf.c
ld/ChangeLog
ld/testsuite/ld-bpf/call-2.d [new file with mode: 0644]
ld/testsuite/ld-bpf/call-2.s [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-data-be.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-data-le.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-data.s [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn-external-be.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn-external-le.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn-external.s [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn32-be.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn32-le.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn32.s [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn64-be.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn64-le.d [new file with mode: 0644]
ld/testsuite/ld-bpf/reloc-insn64.s [new file with mode: 0644]