]> Git Repo - J-linux.git/commitdiff
bpf_helpers.h: Define bpf_tail_call_static when building with GCC
authorJose E. Marchesi <[email protected]>
Fri, 26 Apr 2024 14:51:58 +0000 (16:51 +0200)
committerDaniel Borkmann <[email protected]>
Fri, 26 Apr 2024 15:10:04 +0000 (17:10 +0200)
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 <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
tools/lib/bpf/bpf_helpers.h

index cd17f6d0791fefadbecc68362a4444515177a9b8..62e1c0cc4a59d4259940394bb3e7c6c30e947cb0 100644 (file)
 /*
  * 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,
This page took 0.045877 seconds and 4 git commands to generate.