All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: Yonghong Song <yonghong.song@linux.dev>
Cc: bpf@vger.kernel.org, Yonghong Song <yhs@meta.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	david.faust@oracle.com, cupertino.miranda@oracle.com,
	indu.bhagat@oracle.com
Subject: Re: [PATCH bpf-next] bpf: add a few more options for GCC_BPF in selftests/bpf/Makefile
Date: Wed, 24 Apr 2024 23:24:54 +0200	[thread overview]
Message-ID: <87v8465u8p.fsf@oracle.com> (raw)
In-Reply-To: <744420fb-4b2b-44c8-9e35-1ffd9f086fd9@linux.dev> (Yonghong Song's message of "Wed, 24 Apr 2024 14:05:12 -0700")


Hi Yonghong.

> On 4/24/24 1:41 AM, Jose E. Marchesi wrote:
>> This little patch modifies selftests/bpf/Makefile so it passes the
>> following extra options when invoking gcc-bpf:
>>
>>   -gbtf
>>     This makes GCC to emit BTF debug info in .BTF and .BTF.ext.
>
> Could we do if '-g' is specified, for bpf program,
> btf will be automatically generated?

Hmm, in principle I wouldn't oppose for -g to mean -gbtf instead of
-gdwarf.  DWARF can always be generated by using -gdwarf.

Faust, Indu, WDYT?

>>
>>   -mco-re
>>     This tells GCC to generate CO-RE relocations in .BTF.ext.
>
> Can we make this default? That is, remove -mco-re option. I
> can imagine for any serious bpf program, co-re is a must.

CO-RE depends on BTF.  So I understand the above as making -mco-re the
default if BTF is generated, i.e. if -gbtf (or -g with the modification
above) are specified.  Isn't that what clang does?  Am I interpreting
correctly?

>>
>>   -masm=pseudoc
>>     This tells GCC to emit BPF assembler using the pseudo-c syntax.
>
> Can we make it the other way round such that -masm=pseudoc is
> the default? You can have an option e.g., -masm=non-pseudoc,
> for the other format?

We could add a configure-time build option:

  --with-bpf-default-asm-syntax={pseudoc,normal}

so that GCC can be built to use whatever selected syntax as default.
Distros and people can then decide what to do.

>>
>> Tested in bpf-next master.
>> No regressions.
>>
>> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
>> Cc: Yonghong Song <yhs@meta.com>
>> Cc: Eduard Zingerman <eddyz87@gmail.com>
>> Cc: david.faust@oracle.com
>> Cc: cupertino.miranda@oracle.com
>> ---
>>   tools/testing/selftests/bpf/Makefile | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>> index edc73f8f5aef..702428021132 100644
>> --- a/tools/testing/selftests/bpf/Makefile
>> +++ b/tools/testing/selftests/bpf/Makefile
>> @@ -442,7 +442,7 @@ endef
>>   # Build BPF object using GCC
>>   define GCC_BPF_BUILD_RULE
>>   	$(call msg,GCC-BPF,$(TRUNNER_BINARY),$2)
>> -	$(Q)$(BPF_GCC) $3 -O2 -c $1 -o $2
>> +	$(Q)$(BPF_GCC) $3 -O2 -gbtf -mco-re -masm=pseudoc -c $1 -o $2
>>   endef
>>     SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c

  reply	other threads:[~2024-04-24 21:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  8:41 [PATCH bpf-next] bpf: add a few more options for GCC_BPF in selftests/bpf/Makefile Jose E. Marchesi
2024-04-24 16:47 ` Eduard Zingerman
2024-04-24 21:05 ` Yonghong Song
2024-04-24 21:24   ` Jose E. Marchesi [this message]
2024-04-24 21:47     ` David Faust
2024-04-24 21:48     ` Alexei Starovoitov
2024-04-25 12:32       ` Jose E. Marchesi
2024-04-25 15:40         ` Alexei Starovoitov
2024-04-26 14:41           ` Jose E. Marchesi
2024-04-26 14:47             ` Alexei Starovoitov
2024-04-25 18:20         ` Andrii Nakryiko
2024-04-25 18:48           ` Jose E. Marchesi

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=87v8465u8p.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=eddyz87@gmail.com \
    --cc=indu.bhagat@oracle.com \
    --cc=yhs@meta.com \
    --cc=yonghong.song@linux.dev \
    /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.