bpf_helpers.h: define bpf_tail_call_static when building with GCC
PATCH v2 1/1 bpf_helpers.h: define bpf_tail_call_static when building with GCC
[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.
--- tools/lib/bpf/bpf_helpers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/bpf/bpf_helpers.h +3 -1
@@ -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 ,
Signature · 1 line
2.30.2
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 9 lines · On Fri, 26 Apr 2024 16:51:58 +0200 you wrote:
[Changes from V1;
- Add minimum GCC version that supportsbpf_tail_call_static.]The definition of
bpf_tail_call_staticintools/lib/bpf/bpf_helpers.his 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html