[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250317083142.561104-1-zhangxi@kylinos.cn>
Date: Mon, 17 Mar 2025 16:31:42 +0800
From: zhang Xi <zhangxi@...inos.cn>
To: linux-kernel@...r.kernel.org
Cc: yangtiezhu@...ngson.cn,
yijiangshan@...inos.cn,
zhangxi <zhangxi@...inos.cn>
Subject: [PATCH] selftests/bpf: fix the compilation errors caused by larchintrin.h
From: zhangxi <zhangxi@...inos.cn>
On the Loongson 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.
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