bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next V2] bpf_helpers.h: define bpf_tail_call_static when building with GCC
@ 2024-04-26 14:51 Jose E. Marchesi
  2024-04-26 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Jose E. Marchesi @ 2024-04-26 14:51 UTC (permalink / raw)
  To: bpf
  Cc: Jose E . Marchesi, Andrii Nakryiko, Yonghong Song,
	Eduard Zingerman, david.faust, cupertino.miranda

[Changes from V1;
- Add minimum GCC version that supports bpf_tail_call_static.]

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 13 or later as well.

Tested in bpf-next master.
No regressions.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index cd17f6d0791f..62e1c0cc4a59 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -137,7 +137,8 @@
 /*
  * 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(__clang__) && __GNUC__ > 12)
+#if defined(__bpf__)
 static __always_inline void
 bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
 {
@@ -165,6 +166,7 @@ bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
 		     : "r0", "r1", "r2", "r3", "r4", "r5");
 }
 #endif
+#endif
 
 enum libbpf_pin_type {
 	LIBBPF_PIN_NONE,
-- 
2.30.2


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

* Re: [PATCH bpf-next V2] bpf_helpers.h: define bpf_tail_call_static when building with GCC
  2024-04-26 14:51 [PATCH bpf-next V2] bpf_helpers.h: define bpf_tail_call_static when building with GCC Jose E. Marchesi
@ 2024-04-26 15:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-26 15:20 UTC (permalink / raw)
  To: Jose E. Marchesi
  Cc: bpf, andrii.nakryiko, yhs, eddyz87, david.faust, cupertino.miranda

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Fri, 26 Apr 2024 16:51:58 +0200 you wrote:
> [Changes from V1;
> - Add minimum GCC version that supports bpf_tail_call_static.]
> 
> 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 13 or later as well.
> 
> [...]

Here is the summary with links:
  - [bpf-next,V2] bpf_helpers.h: define bpf_tail_call_static when building with GCC
    https://git.kernel.org/bpf/bpf-next/c/6e25bcf06af0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-04-26 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 14:51 [PATCH bpf-next V2] bpf_helpers.h: define bpf_tail_call_static when building with GCC Jose E. Marchesi
2024-04-26 15:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).