public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] pahole: When trying to encode BTF avoid DWARF less files
@ 2025-04-02 20:35 Arnaldo Carvalho de Melo
  2025-04-03 18:40 ` Alan Maguire
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-04-02 20:35 UTC (permalink / raw)
  To: Alan Maguire; +Cc: dwarves

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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-08 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 20:35 [PATCH 1/1] pahole: When trying to encode BTF avoid DWARF less files Arnaldo Carvalho de Melo
2025-04-03 18:40 ` Alan Maguire
2025-04-04 19:22   ` Arnaldo Carvalho de Melo
2025-04-04 19:37     ` Arnaldo Carvalho de Melo
2025-04-08 10:14   ` Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox