BPF List
 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
Subject: Re: [PATCH] bpf_helpers.h: define bpf_tail_call_static when building with GCC
Date: Wed, 24 Jan 2024 09:24:57 +0100	[thread overview]
Message-ID: <87cytr2l5y.fsf@oracle.com> (raw)
In-Reply-To: <bb8b375a-fdc7-40db-9ebf-ebc89a12f5c7@linux.dev> (Yonghong Song's message of "Tue, 23 Jan 2024 13:19:41 -0800")


> On 1/23/24 10:59 AM, Jose E. Marchesi wrote:
>> The definition of bpf_tail_call_static in tools/lib/bpf/bpf_helpers.h
>> is guarded by a preprocessor check to assure that clang is recent
>> enough to support it.  This patch updates the guard so the function is
>> compiled when using GCC as well.
>>
>> 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/lib/bpf/bpf_helpers.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
>> index 2324cc42b017..3306f50c5081 100644
>> --- a/tools/lib/bpf/bpf_helpers.h
>> +++ b/tools/lib/bpf/bpf_helpers.h
>> @@ -136,7 +136,7 @@
>>   /*
>>    * Helper function to perform a tail call with a constant/immediate map slot.
>>    */
>> -#if __clang_major__ >= 8 && defined(__bpf__)
>> +#if (!defined(__clang__) || __clang_major__ >= 8) && defined(__bpf__)
>
> Do you want to guard with a gcc version as well here or you assume any gcc which supports bpf
> should be okay here?

The second, because GCC versions that do not support
bpf_tail_call_static are not capable of building the selftests for many
other reasons, so there is little point to support them.

>
>>   static __always_inline void
>>   bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
>>   {

  reply	other threads:[~2024-01-24  8:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 18:59 [PATCH] bpf_helpers.h: define bpf_tail_call_static when building with GCC Jose E. Marchesi
2024-01-23 21:19 ` Yonghong Song
2024-01-24  8:24   ` Jose E. Marchesi [this message]
2024-01-24 17:43     ` Andrii Nakryiko

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=87cytr2l5y.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox