public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info
@ 2025-07-22 14:22 Arnaldo Carvalho de Melo
  2025-07-23 19:00 ` Alan Maguire
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-07-22 14:22 UTC (permalink / raw)
  To: Alan Maguire; +Cc: dwarves, bpf

If pahole is asked to encode BTF for a file with no DWARF info, don't
fail, just skip it.

This is the case, for instance, in this file in a kernel build with
DWARF info generation enabled:

  $ pahole ../build/v6.15.0-rc4+/arch/x86/purgatory/purgatory.o
  libbpf: failed to find '.BTF' ELF section in ../build/v6.15.0-rc4+/arch/x86/purgatory/purgatory.o
  pahole: file '../build/v6.15.0-rc4+/arch/x86/purgatory/purgatory.o' has no supported type information.
  $

Before it was failing when encoding BTF for it, now:

  $ pahole --btf_encode ../build/v6.15.0-rc4+/arch/x86/purgatory/purgatory.o
  $ echo $?
  0
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 pahole.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pahole.c b/pahole.c
index 333e71ab65924d2c..a001ec86ef1b0908 100644
--- a/pahole.c
+++ b/pahole.c
@@ -3659,6 +3659,13 @@ try_sole_arg_as_class_names:
 			remaining = argc;
 			goto try_sole_arg_as_class_names;
 		}
+
+		if (btf_encode || ctf_encode) {
+			// If encoding is asked for and there is no DEBUG info to encode from,
+			// there are no errors, continue...
+			goto out_ok;
+		}
+
 		if (argv[remaining] != NULL) {
 			cus__fprintf_load_files_err(cus, "pahole", argv + remaining, err, stderr);
 		} else {
-- 
2.49.0


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

end of thread, other threads:[~2025-07-31  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 14:22 [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info Arnaldo Carvalho de Melo
2025-07-23 19:00 ` Alan Maguire
2025-07-23 19:27   ` Arnaldo Carvalho de Melo
2025-07-31  8:09     ` Alan Maguire

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