For bpftool to be able to dump .BTF.inline data in
/sys/kernel/btf/foo.inline for module foo, it needs to support
multi-split BTF because the parent-child relationship of BTF
inline data for modules is

vmlinux BTF data
        module BTF data
                module BTF inline data

So for example to dump BTF inline info for xfs we would run

$ bpftool btf dump -B /sys/kernel/btf/vmlinux -B /sys/kernel/btf/xfs file 
/sys/kernel/btf/xfs.inline

Multiple bases are specified with the vmlinux base BTF first (parent)
followed by the xfs BTF (child), and finally the XFS BTF extra.

Signed-off-by: Alan Maguire <[email protected]>
---
 tools/bpf/bpftool/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 5ababd8f7d0a..9329f140b700 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -515,7 +515,8 @@ int main(int argc, char **argv)
                        verifier_logs = true;
                        break;
                case 'B':
-                       base_btf = btf__parse(optarg, NULL);
+                       /* handle multi-split BTF */
+                       base_btf = btf__parse_split(optarg, base_btf);
                        if (!base_btf) {
                                p_err("failed to parse base BTF at '%s': %d\n",
                                      optarg, -errno);
-- 
2.43.5


Reply via email to