]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpftool: Support dumping kfunc prototypes from BTF
authorDaniel Xu <dxu@dxuuu.xyz>
Wed, 12 Jun 2024 15:58:36 +0000 (09:58 -0600)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 12 Jun 2024 18:01:32 +0000 (11:01 -0700)
commit770abbb5a25a5b767f1c60ba366aea503728e957
tree93fefc8047f6a553b4e4ce76b3a5e5dab71b444d
parentc567cba34585514f82600a10587c8813c50e3a7c
bpftool: Support dumping kfunc prototypes from BTF

This patch enables dumping kfunc prototypes from bpftool. This is useful
b/c with this patch, end users will no longer have to manually define
kfunc prototypes. For the kernel tree, this also means we can optionally
drop kfunc prototypes from:

        tools/testing/selftests/bpf/bpf_kfuncs.h
        tools/testing/selftests/bpf/bpf_experimental.h

Example usage:

        $ make PAHOLE=/home/dxu/dev/pahole/build/pahole -j30 vmlinux

        $ ./tools/bpf/bpftool/bpftool btf dump file ./vmlinux format c | rg "__ksym;" | head -3
        extern void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) __weak __ksym;
        extern void cgroup_rstat_flush(struct cgroup *cgrp) __weak __ksym;
        extern struct bpf_key *bpf_lookup_user_key(u32 serial, u64 flags) __weak __ksym;

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/bf6c08f9263c4bd9d10a717de95199d766a13f61.1718207789.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/btf.c