diff options
| author | David Faust <david.faust@oracle.com> | 2026-02-04 13:53:34 -0800 |
|---|---|---|
| committer | David Faust <david.faust@oracle.com> | 2026-02-05 12:26:09 -0800 |
| commit | bdb4d0030dedaaf18f09690218a2896ea57a4cdd (patch) | |
| tree | 204157deee3621e972f07f9512c27d23212a2734 /include/opcode | |
| parent | ba61cf9952f4f0c4b3d237348e8e17641918d354 (diff) | |
| download | binutils-bdb4d0030dedaaf18f09690218a2896ea57a4cdd.tar.gz binutils-bdb4d0030dedaaf18f09690218a2896ea57a4cdd.tar.bz2 binutils-bdb4d0030dedaaf18f09690218a2896ea57a4cdd.zip | |
bpf: add may_goto instruction [PR32176]
The BPF "may_goto" instruction is a special sort of conditional jump
where the condition is determined by the BPF runtime. That is, it is
a no-op until the runtime decides otherwise.
For normal asm syntax, the mnemonic "jcond" is chosen in keeping with
the style of following the opcode definitions in the Linux kernel uapi
BPF headers.
This instruction is not currently emitted by GCC, but it can be inserted
into BPF programs via macros defined in the Linux kernel.
PR gas/32176
include/
* opcode/bpf.h (BPF_CODE_JCOND): New.
(bpf_insn_id): Add BPF_INSN_JCOND.
opcodes/
* bpf-opc.c: Add entry for BPF_INSN_JCOND.
gas/testsuite/
* gas/bpf/bpf.exp: Run new dump tests.
* gas/bpf/jcond-be-pseudoc.d: New.
* gas/bpf/jcond-be.d: New.
* gas/bpf/jcond-pseudoc.d: New.
* gas/bpf/jcond-pseudoc.s: New.
* gas/bpf/jcond.d: New.
* gas/bpf/jcond.s: New.
Diffstat (limited to 'include/opcode')
| -rw-r--r-- | include/opcode/bpf.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/opcode/bpf.h b/include/opcode/bpf.h index d4d4f6d8557..e4ccd430f0c 100644 --- a/include/opcode/bpf.h +++ b/include/opcode/bpf.h @@ -106,6 +106,7 @@ typedef uint64_t bpf_insn_word; #define BPF_CODE_JLE ((uint64_t)0xb0 << 56) #define BPF_CODE_JSLT ((uint64_t)0xc0 << 56) #define BPF_CODE_JSLE ((uint64_t)0xd0 << 56) +#define BPF_CODE_JCOND ((uint64_t)0xe0 << 56) #define BPF_MODE_IMM ((uint64_t)0x00 << 56) #define BPF_MODE_ABS ((uint64_t)0x20 << 56) @@ -229,6 +230,9 @@ enum bpf_insn_id BPF_INSN_ACMP, BPF_INSN_AXCHG, /* Atomic compare-and-swap, atomic exchange (32-bit). */ BPF_INSN_ACMP32, BPF_INSN_AXCHG32, + /* Conditional pseudo-jump "may_goto". A NOP until the BPF runtime + decides it isn't. */ + BPF_INSN_JCOND, /* GNU simulator specific instruction. */ BPF_INSN_BRKPT, }; |
