* [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
* Re: [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info
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
0 siblings, 1 reply; 4+ messages in thread
From: Alan Maguire @ 2025-07-23 19:00 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: dwarves, bpf
On 22/07/2025 15:22, Arnaldo Carvalho de Melo wrote:
> 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>
Only potential issue I can see is that in the usual case of encoding BTF
from DWARF in the kernel we'd probably like to fall over if we can't
encode BTF due to DWARF absence. However current Kconfig dependencies of
CONFIG_DEBUG_INFO_BTF mean this can't happen in practice I think so
Reviewed-by: Alan Maguire <alan.maguire@oracle.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 {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info
2025-07-23 19:00 ` Alan Maguire
@ 2025-07-23 19:27 ` Arnaldo Carvalho de Melo
2025-07-31 8:09 ` Alan Maguire
0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-07-23 19:27 UTC (permalink / raw)
To: Alan Maguire; +Cc: dwarves, bpf
On Wed, Jul 23, 2025 at 08:00:31PM +0100, Alan Maguire wrote:
> On 22/07/2025 15:22, Arnaldo Carvalho de Melo wrote:
> > 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>
> Only potential issue I can see is that in the usual case of encoding BTF
> from DWARF in the kernel we'd probably like to fall over if we can't
> encode BTF due to DWARF absence. However current Kconfig dependencies of
> CONFIG_DEBUG_INFO_BTF mean this can't happen in practice I think so
Right, this is an exception, just some .o files out of thousands end up
without DWARF.
So I think that if we take --btf_encode as "Encode BTF from DWARF, if
DWARF is available" is a good interpretation of intent.
- Arnaldo
> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Thanks!
- Arnaldo
> > ---
> > 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 {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info
2025-07-23 19:27 ` Arnaldo Carvalho de Melo
@ 2025-07-31 8:09 ` Alan Maguire
0 siblings, 0 replies; 4+ messages in thread
From: Alan Maguire @ 2025-07-31 8:09 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: dwarves, bpf
On 23/07/2025 20:27, Arnaldo Carvalho de Melo wrote:
> On Wed, Jul 23, 2025 at 08:00:31PM +0100, Alan Maguire wrote:
>> On 22/07/2025 15:22, Arnaldo Carvalho de Melo wrote:
>>> 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>
>
>> Only potential issue I can see is that in the usual case of encoding BTF
>> from DWARF in the kernel we'd probably like to fall over if we can't
>> encode BTF due to DWARF absence. However current Kconfig dependencies of
>> CONFIG_DEBUG_INFO_BTF mean this can't happen in practice I think so
>
> Right, this is an exception, just some .o files out of thousands end up
> without DWARF.
>
> So I think that if we take --btf_encode as "Encode BTF from DWARF, if
> DWARF is available" is a good interpretation of intent.
>
> - Arnaldo
>
>> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
>
> Thanks!
>
Applied to the next branch of
https://git.kernel.org/pub/scm/devel/pahole/pahole.git/
Thanks!
Alan
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).