[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250321073613.1082510-1-zhangxi@kylinos.cn>
Date: Fri, 21 Mar 2025 15:36:13 +0800
From: Zhang Xi <zhangxi@...inos.cn>
To: chenhuacai@...nel.org
Cc: linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
llvm@...ts.linux.de,
yangtiezhu@...ngson.cn,
ast@...nel.org,
daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
eddyz87@...il.com,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
nathan@...nel.org,
nick.desaulniers+lkml@...il.com,
morbo@...gle.com,
justinstitt@...gle.com,
yijiangshan@...inos.cn,
zhangxi <zhangxi@...inos.cn>
Subject: [PATCH v2] selftests/bpf: fix the compilation errors caused by larchintrin.h
From: zhangxi <zhangxi@...inos.cn>
On the LoongArch platform, the header file 'larchintrin.h' is provided by
the package clang-libs, and it is necessary to add CLANG_SYS_INCLUDES to
the compilation command.
make M=samples/bpf, compilation errors:
In file included from sockex2_kern.c:2:
In file included from /root/work/src/github/linux/include/uapi/linux/in.h:25:
In file included from /root/work/src/github/linux/include/linux/socket.h:8:
In file included from /root/work/src/github/linux/include/linux/uio.h:9:
In file included from /root/work/src/github/linux/include/linux/thread_info.h:60:
In file included from /root/work/src/github/linux/arch/loongarch/include/asm/thread_info.h:15:
In file included from /root/work/src/github/linux/arch/loongarch/include/asm/processor.h:13:
In file included from /root/work/src/github/linux/arch/loongarch/include/asm/cpu-info.h:11:
/root/work/src/github/linux/arch/loongarch/include/asm/loongarch.h:13:10: fatal error: 'larchintrin.h' file not found
13 | #include <larchintrin.h>
Signed-off-by: zhangxi <zhangxi@...inos.cn>
---
samples/bpf/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index dd9944a97b7e..f459360c99bc 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -337,6 +337,10 @@ endef
CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
+ifeq ($(ARCH), loongarch)
+CLANG_CFLAGS = $(CLANG_SYS_INCLUDES)
+endif
+
$(obj)/xdp_router_ipv4.bpf.o: $(obj)/xdp_sample.bpf.o
$(obj)/%.bpf.o: $(src)/%.bpf.c $(obj)/vmlinux.h $(src)/xdp_sample.bpf.h $(src)/xdp_sample_shared.h
@@ -376,7 +380,7 @@ $(obj)/%.o: $(src)/%.c
@echo " CLANG-bpf " $@
$(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(BPF_EXTRA_CFLAGS) \
-I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \
- -I$(LIBBPF_INCLUDE) \
+ -I$(LIBBPF_INCLUDE) $(CLANG_CFLAGS)\
-D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \
-D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
--
2.25.1
Powered by blists - more mailing lists