Make sure only DWARF is expected when encoding BTF. In time BTF will also be accepted, to fixup or augment info produced by some producer, be it gcc, clang, pahole or some other tool, for now, avoid trying to use BTF when DWARF isn't available. Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> --- pahole.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pahole.c b/pahole.c index af3e1cfe224dd14a..f247ff5e88feeb95 100644 --- a/pahole.c +++ b/pahole.c @@ -3493,6 +3493,14 @@ int main(int argc, char *argv[]) goto out; } + // Right now encoding BTF has to be from DWARF, so enforce that, otherwise + // the loading process can fall back to other formats, BTF being the case + // and as this is at this point unintended, avoid that. + // Next we need to just skip object files that don't have the format we + // expect as the source for BTF encoding, i.e. no DWARF, no BTF, no problema. + if (btf_encode && conf_load.format_path == NULL) + conf_load.format_path = "dwarf"; + if (show_running_kernel_vmlinux) { const char *vmlinux = vmlinux_path__find_running_kernel(); -- 2.49.0