selftests/bpf: Fix a selftest compilation error
Subsystems (3)
Yonghong Song
reviewerPATCH 1/1 selftests/bpf: Fix a selftest compilation error
When building the kernel and selftest with clang compiler (llvm17 or llvm18), I hit the following compilation failure:
In file included from progs/test_lwt_redirect.c:3:
In file included from /usr/include/linux/ip.h:21:
In file included from /usr/include/asm/byteorder.h:5:
In file included from /usr/include/linux/byteorder/little_endian.h:13:
/usr/include/linux/swab.h:136:8: error: unknown type name '__always_inline'
136 | static __always_inline unsigned long __swab(const unsigned long y)
| ^
/usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
171 | static __always_inline __u16 __swab16p(const __u16 *p)
...
bpf_helpers.h file provided a definition for __always_inline. Putting 'ip.h' after 'bpf_helpers.h' fixed the issue.
--- tools/testing/selftests/bpf/progs/test_lwt_redirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_lwt_redirect.c +1 -1
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> -#include <linux/ip.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_helpers.h> +#include <linux/ip.h> #include "bpf_tracing_net.h" /* We don't care about whether the packet can be received by network stack.
Signature · 1 line
2.34.1
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 10 lines · On Fri, 18 Aug 2023 10:43:12 -0700 you wrote:
When building the kernel and selftest with clang compiler (llvm17 or llvm18), I hit the following compilation failure:
In file included fromprogs/test_lwt_redirect.c:3:
In file included from/usr/include/linux/ip.h:21:
In file included from/usr/include/asm/byteorder.h:5:
In file included from/usr/include/linux/byteorder/little_endian.h:13:
/usr/include/linux/swab.h:136:8: error: unknown type name '__always_inline'
136 | static__always_inlineunsigned long__swab(const unsigned long y)
| ^
/usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
Quoted 4 lines
171 | static __always_inline __u16 __swab16p(const __u16 *p)...
[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Fix a selftest compilation error
https://git.kernel.org/bpf/bpf-next/c/0a55264cf966
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html