From a49e0498c3a396326db443662345888844bea06b Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Wed, 12 Apr 2023 11:48:13 +0200 Subject: [PATCH] UBUNTU: SAUCE: selftests/bpf: ignore pointer types check with clang Building bpf selftests with clang can trigger errors like the following: CLNG-BPF [test_maps] bpf_iter_netlink.bpf.o progs/bpf_iter_netlink.c:32:4: error: incompatible pointer types assigning to 'struct sock *' from 'struct sock___17 *' [-Werror,-Wincompatible-pointer-types] s = &nlk->sk; ^ ~~~~~~~~ 1 error generated. This is due to the fact that bpftool emits duplicate data types with different names in vmlinux.h (i.e., `struct sock` in this case) and these types, despite having a different name, represent in fact the same object. Add -Wno-incompatible-pointer-types to CLANG_CLAGS to prevent these errors. (cherry picked from https://lore.kernel.org/lkml/20230412095912.188453-1-andrea.righi@canonical.com/T/#u) [ arighi: drop this when we move to pahole >= 1.25 ] Signed-off-by: Andrea Righi --- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index fd15017ed3b1..de302f8d4fe7 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -386,7 +386,8 @@ BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \ # TODO: enable me -Wsign-compare CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \ - -Wno-compare-distinct-pointer-types + -Wno-compare-distinct-pointer-types \ + -Wno-incompatible-pointer-types $(OUTPUT)/test_l4lb_noinline.o: BPF_CFLAGS += -fno-inline $(OUTPUT)/test_xdp_noinline.o: BPF_CFLAGS += -fno-inline