All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: dwarves@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH 1/1] pahole: Don't fail when encoding BTF on an object with no DWARF info
Date: Wed, 23 Jul 2025 16:27:11 -0300	[thread overview]
Message-ID: <aIE3j4kcn7pzLA4P@x1> (raw)
In-Reply-To: <92260366-5a4f-42bb-8306-2d8e25aba4e8@oracle.com>

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 {

  reply	other threads:[~2025-07-23 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-07-31  8:09     ` Alan Maguire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aIE3j4kcn7pzLA4P@x1 \
    --to=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.