On Fri, Sep 27, 2024 at 02:52:24PM -0700, Andrii Nakryiko wrote: > 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! Minor clash with Alan's Fixes: 5205d02d8e84a775 ("btf_encoder: record BTF-centric function state instead of DWARF-centric") Fixed up, testing. - Arnaldo