[PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux