[clang] [llvm] [BPF] introduce `__attribute__((bpf_fastcall))` (PR #101228)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 12:25:08 PDT 2024


yonghong-song wrote:

@AaronBallman Just want to clarify about linking. For bpf ecosystem, we do not do linking with llvm lld. We do linking with bpftool (see https://www.mankier.com/8/bpftool-gen) as there are special requirements to *glue* bpf programs together.

In bpf_fastcall use case, the function to be inlined is not in BPF programs but in kernel. For some specific kernel functions called from bpf program. In old kernel, where bpf_fastcall not available to them, nothing changes, bpf program will call them as usual. In new kernel where kernel implements to process bpf_fastcall generated code,
kernel can implement inlining since it knows what exactly that function intends to do. Of course we only target
*simple* kernel functions at this moment.

So your concern about a func in bpf lib compiled with bpf_fastcall attribute ignored won't be an issue here.

In the future, if we indeed intend to inline bpf functions in library, I guess those functions can be defined in header files.

https://github.com/llvm/llvm-project/pull/101228


More information about the llvm-commits mailing list