diff options
author | 2023-07-24 01:15:08 +0200 | |
---|---|---|
committer | 2023-07-24 01:20:03 +0200 | |
commit | c2ca88d74ba3618c4aac6744e923c279ca4cb7f1 (patch) | |
tree | cdd500a8a997bd1a8f908176d8f5fe4143d0542d /opcodes/bpf-opc.c | |
parent | Use 'name' in DAP start_thread function (diff) | |
download | binutils-gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.tar.gz binutils-gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.tar.bz2 binutils-gdb-c2ca88d74ba3618c4aac6744e923c279ca4cb7f1.zip |
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 'opcodes/bpf-opc.c')
-rw-r--r-- | opcodes/bpf-opc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/opcodes/bpf-opc.c b/opcodes/bpf-opc.c index efd32577821..4ffd86719a7 100644 --- a/opcodes/bpf-opc.c +++ b/opcodes/bpf-opc.c @@ -303,6 +303,10 @@ const struct bpf_opcode bpf_opcodes[] = {BPF_INSN_JNEI, "jne%W%dr , %i32 , %d16", "if%w%dr != %i32%wgoto%w%d16", BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_JNE|BPF_SRC_K}, + /* 32-bit jump-always. */ + {BPF_INSN_JAL, "jal%W%d32", "gotol%w%d32", + BPF_V4, BPF_CODE, BPF_CLASS_JMP32|BPF_CODE_JA|BPF_SRC_K}, + /* 32-bit compare-and-jump instructions (reg OP reg). */ {BPF_INSN_JEQ32R, "jeq32%W%dr , %sr , %d16", "if%w%dw == %sw%wgoto%w%d16", BPF_V3, BPF_CODE, BPF_CLASS_JMP32|BPF_CODE_JEQ|BPF_SRC_X}, |