All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: "Holger Hoffstätte" <holger@applied-asynchrony.com>
Cc: bpf@vger.kernel.org, indu.bhagat@oracle.com
Subject: Re: Using gcc-bpf for bpftool: problems with CO-RE feature detection
Date: Sat, 09 Nov 2024 17:02:11 +0100	[thread overview]
Message-ID: <87zfm8bdx2.fsf@oracle.com> (raw)
In-Reply-To: <8665818f-8a32-3796-1efc-1a9e5d036f18@applied-asynchrony.com> ("Holger Hoffstätte"'s message of "Sat, 9 Nov 2024 12:55:36 +0100")


Hello.

> I'm trying to use Gentoo's bpf-toolchain - basically just gcc built for
> the BPF target - to build the CO-RE support in bpftool, in order to
> provide an alternative to clang.
>
> This currently fails because the feature detection relies on a comment
> in the generated BPF assembly, which gcc does not seem to generate.
>
> While I'm using the Github mirror for bpftool, the same check is
> being done in the kernel build, so it affects both.
>
> Our tracker bug with full output etc. is: https://bugs.gentoo.org/943113
>
> Basically the problem boils down to:
>
> 	.long	16777248                        # 0x1000020
> 	.long	9                               # BTF_KIND_VAR(id = 3)
> 	.long	234881024                       # 0xe000000
>
> generated by clang (19.1.3)
>
> vs.
>
> 	.4byte	0x1000020
> 	.4byte	0x9
> 	.4byte	0xe000000
>
> generated by gcc (14.2.0).
>
> As the values themselves are correct, the problem is really just
> the missing debug information in gcc's output. So far I've tried
> every option I could find, but to no avail. I have no idea whether
> this is because I'm holding it wrong, gcc cannot do it for the bpf
> target (yet?) or anything else.
>
> Does anybody know how I can convince gcc to generate symbol comments?
> Alternatively can we find a better way to verify the generated output
> instead of grepping for a comment?

GCC can generate similar comments if you pass the -dA option.  These are
intended for testing the generated BTF in the GCC testsuite, however,
and right now I don't remember whether the comments mimic what clang
generates.  You can give it a try...

>
> This is not really a bug, but IMHO having an alternative toolchain to
> build BPF seems like a good idea in general. Gentoo's bpf-toolchain
> package was initially made to build dtrace, and seems to be working
> fine so far.
>
> Thanks for any suggestions!
>
> cheers
> Holger

  reply	other threads:[~2024-11-09 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09 11:55 Using gcc-bpf for bpftool: problems with CO-RE feature detection Holger Hoffstätte
2024-11-09 16:02 ` Jose E. Marchesi [this message]
2024-11-09 19:00   ` Holger Hoffstätte

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=87zfm8bdx2.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=holger@applied-asynchrony.com \
    --cc=indu.bhagat@oracle.com \
    /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.