On Mon, Sep 16, 2024 at 2:19 AM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > For kfuncs marked with KF_FASTCALL flag generate the following pair of > decl tags: > > $ bpftool btf dump file vmlinux > ... > [A] FUNC 'bpf_rdonly_cast' type_id=... > ... > [B] DECL_TAG 'bpf_kfunc' type_id=A component_idx=-1 > [C] DECL_TAG 'bpf_fastcall' type_id=A component_idx=-1 > > So that bpftool could find 'bpf_fastcall' decl tag and generate > appropriate C declarations for such kfuncs, e.g.: > > #ifndef __VMLINUX_H__ > #define __VMLINUX_H__ > ... > #define __bpf_fastcall __attribute__((bpf_fastcall)) > ... > __bpf_fastcall extern void *bpf_rdonly_cast(...) ...; > > For additional information about 'bpf_fastcall' attribute, > see the following commit in the LLVM source tree: > > 64e464349bfc ("[BPF] introduce __attribute__((bpf_fastcall))") > > And the following Linux kernel commit: > > 52839f31cece ("Merge branch 'no_caller_saved_registers-attribute-for-helper-calls'") > > Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > --- > btf_encoder.c | 59 +++++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 43 insertions(+), 16 deletions(-) > LGTM, Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Arnaldo, can you please take a look and if everything seems sane apply it to pahole master, so it's easier to use it locally? Thanks! [...]