This is my initial take on how to start using libbpf from pahole with the intent to reuse as much functionality from libbpf as possible. This is also necessary to do BTF deduplication, because btf__dedup() is implemented only as part of libbpf. Patch #2 adds submodule and corresponding cmake changes to build against libbpf. Patch #3 removes pahole's btf.h copy and references one from libbpf to test that libbpf is usable. If this approach will be deemed good, I'll continue refactoring of btf_encoder and btf_loader to utilize libbpf more fully and also use btf__dedup. Andrii Nakryiko (3): pahole: add build dir, config.h to .gitignore pahole: add libbpf as submodule under lib/bpf pahole: use btf.h directly from libbpf .gitignore | 2 + .gitmodules | 3 ++ CMakeLists.txt | 32 ++++++++++- btf.h | 140 ------------------------------------------------- btf_encoder.c | 2 +- btf_loader.c | 2 +- lib/bpf | 1 + libbtf.c | 2 +- 8 files changed, 39 insertions(+), 145 deletions(-) create mode 100644 .gitignore create mode 100644 .gitmodules delete mode 100644 btf.h create mode 160000 lib/bpf -- 2.17.1