binutils Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gas/bpf

BPF assembler: normalize mnemonics with `%t` for better parsing

BPF assembler's mnemonic parsing is improved by consistently using `%t` after mnemonics, preventing errors with adjacent operands.

This commit refines the BPF assembler’s parsing of mnemonics by applying the %t directive more broadly. This directive signifies the end of a mnemonic, ensuring that subsequent operands are not misinterpreted as part of the mnemonic itself. The change updates 65 sites in tc-bpf.c and opcodes/bpf-opc.c, addressing potential assembly errors, especially when mnemonics are immediately followed by operands without whitespace. It also adjusts parsing rules for the lock mnemonic to correctly handle its operand.

In Details

Following the fix for PR 34558, the goto mnemonic was updated to use %t to signify its termination, preventing it from consuming adjacent operands. This change extends that fix to all other mnemonics in the BPF opcode table, including if, lock, gotol, call, callx, may_goto, various le*/be*/bswap* operations, and lock. The %t directive ensures a clear boundary between mnemonics and their operands. Special handling is added for lock to prevent * from being treated as part of the mnemonic, and two cases with tight spacing (ifr1>r2 goto+1, callxr1) are now correc…

For Context
%t
A directive used in gas assembler's opcode tables to mark the termination of a mnemonic, separating it from subsequent operands and ensuring correct parsing.
Mnemonic
A symbolic name representing a machine language instruction.
Pseudo-C dialect
A syntax used in some assemblers, like for BPF, that mimics C language constructs for better readability and expressiveness, particularly for complex instructions or addressing modes.
Filed Under: bpfassemblerparsing