diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-03-04 15:56:51 -0500 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-03-05 15:03:02 -0800 |
| commit | d8d5c0151148b0194e8bbba66eb56d4d9cab94cd (patch) | |
| tree | 36ac07c725144300f6796e920ed7cd21068a052a /tools/perf/scripts/python/stackcollapse.py | |
| parent | be872ccf370915b858ab693aa0707a2eff4bb1fd (diff) | |
bpftool: Support merging multiple module BTFs in btf dump
Add support for specifying multiple file sources in 'bpftool btf dump'
to generate a single C header containing types from vmlinux plus
multiple kernel modules:
bpftool btf dump file /sys/kernel/btf/mod1 file /sys/kernel/btf/mod2 format c
This is useful for BPF programs that need to access types defined in
kernel modules. Previously this required a separate bpftool invocation
for each module, producing separate headers that could not be combined
due to overlapping vmlinux type definitions.
The implementation collects all file paths, then for the multi-file
case creates an empty split BTF on the vmlinux base and iteratively
merges each module's types into it via btf__add_btf(). The single-file
code path is preserved exactly to avoid any regression risk.
Auto-detection of vmlinux as the base BTF from sysfs paths works as
before. If vmlinux itself appears in the file list it is skipped with
a warning since its types are already provided by the base.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/b19c2760ffe48cec546dd3810d237f8cad20d606.1772657690.git.josef@toxicpanda.com
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
