From: sdf@google.com
To: SuHsueyu <anolasc13@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: Support for gcc
Date: Tue, 20 Dec 2022 09:27:12 -0800 [thread overview]
Message-ID: <Y6HwQSCdxkRS00q9@google.com> (raw)
In-Reply-To: <CAEc2n-vmWk6+hG-fcqvMdeG-hSyuFoHv9R79U5MjnOU7nXQSpw@mail.gmail.com>
On 12/20, SuHsueyu wrote:
> Hello, I use gcc 12.1.0 to compile a source file:
> t.c
> struct t {
> int a:2;
> int b:3;
> int c:2;
> } g;
> with gcc -c -gbtf t.c
> and try to use libbpf API btf__parse_split, bpf_object__open, and
> bpf_object__open to parse and load into the kernel, but it failed with
> "libbpf: elf: /path/to/t.o is not a valid eBPF object file".
> Is it wrong for me to do so? Due to some constraint, I cannot use
> clang but gcc. How to parse and load gcc compiled object file with
> libbpf?
I haven't used gcc myself, so can't really help. All I can do is to
point you to these two places:
* https://gcc.gnu.org/wiki/BPFBackEnd
* tools/testing/selftests/bpf/Makefile
Maybe try to follow the instructions on that BPFBackEnd page and try
to compile kernel's selftests to see what's missing?
next prev parent reply other threads:[~2022-12-20 17:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 11:45 Support for gcc SuHsueyu
2022-12-20 17:27 ` sdf [this message]
2022-12-21 0:34 ` Andrii Nakryiko
2022-12-21 11:03 ` SuHsueyu
2022-12-21 17:41 ` Alan Maguire
2022-12-21 18:26 ` Jose E. Marchesi
2022-12-21 18:22 ` Jose E. Marchesi
2022-12-21 18:30 ` Jose E. Marchesi
2022-12-25 15:24 ` SuHsueyu
2022-12-26 9:42 ` Jose E. Marchesi
-- strict thread matches above, loose matches on Subject: below --
2022-12-29 18:22 Marc Poulhiès
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=Y6HwQSCdxkRS00q9@google.com \
--to=sdf@google.com \
--cc=anolasc13@gmail.com \
--cc=bpf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox