Spell xBPF indirect calls as 'callx' in pseudo-C
BPF pseudo-C dialect now correctly spells indirect calls as 'callx'.
This commit corrects the spelling of indirect calls in GCC’s pseudo-C dialect for the BPF target. Previously, both direct and indirect calls used the same call template, causing assembly errors when compiling with -mxbpf because the assembler expected callx for indirect calls. The fix separates the call target constraint into two alternatives, using callx specifically for register-based indirect calls.
In Details
The BPF call instruction patterns in bpf.md incorrectly used a single template for both direct (call) and indirect (callx) calls when -mxbpf was used. This led to assembly errors because the pseudo-C dialect expected callx for indirect calls but received call rN. This commit splits the call_internal and call_value_internal patterns based on the call target constraint (constant address vs. register), allowing the callx spelling for register-based indirect calls.
- BPF
- Berkeley Packet Filter, a technology that allows sandboxed programs to execute in the Linux kernel without changing kernel source code.
- pseudo-C
- An intermediate representation used by GCC that resembles C code, often for debugging or diagnostics.
- callx
- An instruction in some extended BPF (eBPF) versions that performs an indirect call.
- -mxbpf
- A GCC flag for the BPF backend that previously enabled extended features, now primarily used to pass information to the assembler.