diff options
author | fenglei <1579628578@qq.com> | 2025-01-14 16:50:10 +0800 |
---|---|---|
committer | Benoit Ganne <bganne@cisco.com> | 2025-01-17 16:30:55 +0000 |
commit | 38097970c038de6c3c67cb8e1c7209f1df1f24d0 (patch) | |
tree | fd333a81a035044a5a972044d383aebf0b5787dc | |
parent | eaf1059c8bad07268578eac3bdbbb116da0be38b (diff) |
af_xdp: fix af_xdp compile waring for clang compiler
Type: fix
- add check variable undefine init flags for gcc and clang compiler
- disable compile xdp-dump
Change-Id: Icd2b81ec5cd5dc66db395a69f8af889635f664e0
Signed-off-by: fenglei <1579628578@qq.com>
3 files changed, 55 insertions, 26 deletions
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 index 00000000000..4a3fe14364e --- /dev/null +++ b/build/external/patches/xdp-tools_1.2.9/0003-lib-define.mk-add-flags-for-compiler.patch @@ -0,0 +1,29 @@ +From 6b0770e70df3ab02ad2a62f6426668746d4432ba Mon Sep 17 00:00:00 2001 +From: fenglei <1579628578@qq.com> +Date: Wed, 15 Jan 2025 09:47:36 +0800 +Subject: [PATCH 5/5] lib/define.mk: add flags for compiler + +Signed-off-by: fenglei <1579628578@qq.com> +--- + 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 index 6ab74171dc6..00000000000 --- a/build/external/patches/xdp-tools_1.2.9/0003-libxdp-fix-maybe-uninitialized-compiler-warning.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3033b9bdbcdb270f15373b27933d554f847e01d4 Mon Sep 17 00:00:00 2001 -From: Yulong <yulong.pei@intel.com> -Date: Fri, 6 Jan 2023 14:31:24 +0000 -Subject: [PATCH 3/3] libxdp: fix maybe-uninitialized compiler warning - -Signed-off-by: Yulong <yulong.pei@intel.com> ---- - 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 index 00000000000..f7bfd1af454 --- /dev/null +++ b/build/external/patches/xdp-tools_1.2.9/0005-xdp-dump-disable-xdp-dump.patch @@ -0,0 +1,26 @@ +From 8ea104c5c772c176756ce5432d1d71f90c92b3c0 Mon Sep 17 00:00:00 2001 +From: fenglei <1579628578@qq.com> +Date: Fri, 17 Jan 2025 16:59:02 +0800 +Subject: [PATCH] xdp-dump: disable xdp-dump + +Signed-off-by: fenglei <1579628578@qq.com> +--- + 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 + |