mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
3ee9565c95
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.
21 lines
478 B
Makefile
21 lines
478 B
Makefile
#as: --EL
|
|
#source: call-2.s
|
|
#source: bar.s
|
|
#objdump: -dr
|
|
#ld: -EL
|
|
#name: CALL with disp32 reloc and addend
|
|
|
|
.*: +file format .*bpf.*
|
|
|
|
Disassembly of section .text:
|
|
|
|
[0-9a-f]+ <.*>:
|
|
*[0-9a-f]+: b7 01 00 00 01 00 00 00 mov %r1,1
|
|
*[0-9a-f]+: 85 10 00 00 02 00 00 00 call 2
|
|
*[0-9a-f]+: 95 00 00 00 00 00 00 00 exit
|
|
|
|
[0-9a-f]+ <bar>:
|
|
*[0-9a-f]+: bf 21 00 00 00 00 00 00 mov %r1,%r2
|
|
*[0-9a-f]+: bf 13 00 00 00 00 00 00 mov %r3,%r1
|
|
*[0-9a-f]+: 95 00 00 00 00 00 00 00 exit
|