af_xdp: fix af_xdp compile waring for clang compiler 41/42141/6
authorfenglei <[email protected]>
Tue, 14 Jan 2025 08:50:10 +0000 (16:50 +0800)
committerBenoit Ganne <[email protected]>
Fri, 17 Jan 2025 16:30:55 +0000 (16:30 +0000)
Type: fix

- add check variable undefine init flags for gcc and clang compiler
- disable compile xdp-dump

Change-Id: Icd2b81ec5cd5dc66db395a69f8af889635f664e0
Signed-off-by: fenglei <[email protected]>
build/external/patches/xdp-tools_1.2.9/0003-lib-define.mk-add-flags-for-compiler.patch [new file with mode: 0644]
build/external/patches/xdp-tools_1.2.9/0003-libxdp-fix-maybe-uninitialized-compiler-warning.patch [deleted file]
build/external/patches/xdp-tools_1.2.9/0005-xdp-dump-disable-xdp-dump.patch [new file with mode: 0644]

diff --git a/build/external/patches/xdp-tools_1.2.9/0003-lib-define.mk-add-flags-for-compiler.patch b/build/external/patches/xdp-tools_1.2.9/0003-lib-define.mk-add-flags-for-compiler.patch
new file mode 100644 (file)
index 0000000..4a3fe14
--- /dev/null
@@ -0,0 +1,29 @@
+From 6b0770e70df3ab02ad2a62f6426668746d4432ba Mon Sep 17 00:00:00 2001
+From: fenglei <[email protected]>
+Date: Wed, 15 Jan 2025 09:47:36 +0800
+Subject: [PATCH 5/5] lib/define.mk: add flags for compiler
+
+Signed-off-by: fenglei <[email protected]>
+---
+ lib/defines.mk | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lib/defines.mk b/lib/defines.mk
+index f3ff3d3..781d5f2 100644
+--- a/lib/defines.mk
++++ b/lib/defines.mk
+@@ -41,6 +41,11 @@ endif
+ DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+ CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES) $(ARCH_INCLUDES)
++ifeq ($(CC), clang)
++    CFLAGS += -Wno-uninitialized
++else
++    CFLAGS += -Wno-maybe-uninitialized
++endif
+ BPF_CFLAGS += $(DEFINES) $(filter -ffile-prefix-map=%,$(CFLAGS)) $(ARCH_INCLUDES)
+ CONFIGMK := $(LIB_DIR)/../config.mk
+-- 
+2.43.0
+
diff --git a/build/external/patches/xdp-tools_1.2.9/0003-libxdp-fix-maybe-uninitialized-compiler-warning.patch b/build/external/patches/xdp-tools_1.2.9/0003-libxdp-fix-maybe-uninitialized-compiler-warning.patch
deleted file mode 100644 (file)
index 6ab7417..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-From 3033b9bdbcdb270f15373b27933d554f847e01d4 Mon Sep 17 00:00:00 2001
-From: Yulong <[email protected]>
-Date: Fri, 6 Jan 2023 14:31:24 +0000
-Subject: [PATCH 3/3] libxdp: fix maybe-uninitialized compiler warning
-
-Signed-off-by: Yulong <[email protected]>
----
- lib/common.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/common.mk b/lib/common.mk
-index 56c0406..f7a88a1 100644
---- a/lib/common.mk
-+++ b/lib/common.mk
-@@ -101,7 +101,7 @@ $(LIB_OBJS): %.o: %.c %.h $(LIB_H)
- ALL_EXEC_TARGETS=$(USER_TARGETS) $(TEST_TARGETS)
- $(ALL_EXEC_TARGETS): %: %.c  $(OBJECT_LIBBPF) $(OBJECT_LIBXDP) $(LIBMK) $(LIB_OBJS) $(KERN_USER_H) $(EXTRA_DEPS) $(EXTRA_USER_DEPS)
--      $(QUIET_CC)$(CC) -Wall $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(LIB_OBJS) \
-+      $(QUIET_CC)$(CC) -Wall -Wno-maybe-uninitialized $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(LIB_OBJS) \
-        $< $(LDLIBS)
- $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EXTRA_DEPS) $(BPF_HEADERS) $(LIBMK)
--- 
-2.25.1
-
diff --git a/build/external/patches/xdp-tools_1.2.9/0005-xdp-dump-disable-xdp-dump.patch b/build/external/patches/xdp-tools_1.2.9/0005-xdp-dump-disable-xdp-dump.patch
new file mode 100644 (file)
index 0000000..f7bfd1a
--- /dev/null
@@ -0,0 +1,26 @@
+From 8ea104c5c772c176756ce5432d1d71f90c92b3c0 Mon Sep 17 00:00:00 2001
+From: fenglei <[email protected]>
+Date: Fri, 17 Jan 2025 16:59:02 +0800
+Subject: [PATCH] xdp-dump: disable xdp-dump
+
+Signed-off-by: fenglei <[email protected]>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 6a7f575..b445037 100644
+--- a/Makefile
++++ b/Makefile
+@@ -16,7 +16,7 @@ endif
+ include version.mk
+ include config.mk
+-UTILS := xdp-filter xdp-loader xdp-dump
++UTILS := xdp-filter xdp-loader
+ ifneq ($(BPFTOOL),)
+ UTILS += xdp-bench xdp-forward xdp-monitor xdp-trafficgen
+-- 
+2.43.0
+