diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2023-07-24 01:15:08 +0200 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2023-07-24 01:20:03 +0200 |
commit | c2ca88d74ba3618c4aac6744e923c279ca4cb7f1 (patch) | |
tree | cdd500a8a997bd1a8f908176d8f5fe4143d0542d /bfd | |
parent | 338b21b0881e16bb7116e4eb5bc41817f805ec23 (diff) | |
download | gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.zip gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.tar.gz gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.tar.bz2 |
bpf: add support for jal/gotol jump instruction with 32-bit target
This patch adds support for the V4 BPF instruction jal/gotol, which is
like ja/goto but it supports a signed 32-bit PC-relative (in number of
64-bit words minus one) target operand instead of the 16-bit signed
operand of the other instruction. This greatly increases the jump
range in BPF programs.
Tested in bpf-unkown-none.
bfd/ChangeLog:
2023-07-24 Jose E. Marchesi <jose.marchesi@oracle.com>
* reloc.c: New reloc BFD_RELOC_BPF_DISPCALL32.
* elf64-bpf.c (bpf_reloc_type_lookup): Handle the new reloc.
* libbfd.h (bfd_reloc_code_real_names): Regenerate.
gas/ChangeLog:
2023-07-24 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-bpf.c (struct bpf_insn): New field `id'.
(md_assemble): Save the ids of successfully parsed instructions
and use the new BFD_RELOC_BPF_DISPCALL32 whenever appropriate.
(md_apply_fix): Adapt to the new BFD reloc.
* testsuite/gas/bpf/jump.s: Test JAL.
* testsuite/gas/bpf/jump.d: Likewise.
* testsuite/gas/bpf/jump-pseudoc.d: Likewise.
* testsuite/gas/bpf/jump-be.d: Likewise.
* testsuite/gas/bpf/jump-be-pseudoc.d: Likewise.
* doc/c-bpf.texi (BPF Instructions): Document new instruction
jal/gotol.
Document new operand type disp32.
include/ChangeLog:
2023-07-24 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcode/bpf.h (enum bpf_insn_id): Add entry BPF_INSN_JAL.
(enum bpf_insn_id): Remove spurious entry BPF_INSN_CALLI.
opcodes/ChangeLog:
2023-07-23 Jose E. Marchesi <jose.marchesi@oracle.com>
* bpf-opc.c (bpf_opcodes): Add entry for jal.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 1 | ||||
-rw-r--r-- | bfd/elf64-bpf.c | 1 | ||||
-rw-r--r-- | bfd/libbfd.h | 1 | ||||
-rw-r--r-- | bfd/reloc.c | 2 |
5 files changed, 11 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 553dea5..db032df 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2023-07-24 Jose E. Marchesi <jose.marchesi@oracle.com> + + * reloc.c: New reloc BFD_RELOC_BPF_DISPCALL32. + * elf64-bpf.c (bpf_reloc_type_lookup): Handle the new reloc. + * libbfd.h (bfd_reloc_code_real_names): Regenerate. + 2023-07-09 Fangrui Song <maskray@google.com> PR 30592 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ba7440c..5f49807 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7148,6 +7148,7 @@ assembler and not (currently) written to any object files. */ /* Linux eBPF relocations. */ BFD_RELOC_BPF_64, BFD_RELOC_BPF_DISP32, + BFD_RELOC_BPF_DISPCALL32, BFD_RELOC_BPF_DISP16, /* Adapteva EPIPHANY - 8 bit signed pc-relative displacement */ diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c index 23ede4e..aefad7d 100644 --- a/bfd/elf64-bpf.c +++ b/bfd/elf64-bpf.c @@ -88,6 +88,7 @@ bpf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, case BFD_RELOC_BPF_64: return &bpf_elf_howto_table[ (int) R_BPF_64_64_IDX]; case BFD_RELOC_BPF_DISP32: + case BFD_RELOC_BPF_DISPCALL32: return &bpf_elf_howto_table[ (int) R_BPF_64_32_IDX]; case BFD_RELOC_BPF_DISP16: return &bpf_elf_howto_table[ (int) R_BPF_GNU_64_16_IDX]; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 5dbb087..1fc88a8 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -3346,6 +3346,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD", "BFD_RELOC_BPF_64", "BFD_RELOC_BPF_DISP32", + "BFD_RELOC_BPF_DISPCALL32", "BFD_RELOC_BPF_DISP16", "BFD_RELOC_EPIPHANY_SIMM8", "BFD_RELOC_EPIPHANY_SIMM24", diff --git a/bfd/reloc.c b/bfd/reloc.c index e71a510..07d35e4 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -7754,6 +7754,8 @@ ENUM ENUMX BFD_RELOC_BPF_DISP32 ENUMX + BFD_RELOC_BPF_DISPCALL32 +ENUMX BFD_RELOC_BPF_DISP16 ENUMDOC Linux eBPF relocations. |