All of lore.kernel.org
 help / color / mirror / Atom feed
* Using gcc-bpf for bpftool: problems with CO-RE feature detection
@ 2024-11-09 11:55 Holger Hoffstätte
  2024-11-09 16:02 ` Jose E. Marchesi
  0 siblings, 1 reply; 3+ messages in thread
From: Holger Hoffstätte @ 2024-11-09 11:55 UTC (permalink / raw)
  To: bpf

Hi,

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?

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

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

end of thread, other threads:[~2024-11-09 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-11-09 19:00   ` Holger Hoffstätte

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.