From 57f84a75b2a23d4213f36b98585b665090a6b9c3 Mon Sep 17 00:00:00 2001 From: actions-user Date: Wed, 26 Nov 2025 16:30:01 +0800 Subject: [PATCH] Merge Official Source --- Makefile | 10 ++-- patches/010-configure-respect-LDFLAGS.patch | 6 +- ...to-allow-overwriting-llc-s-march-arg.patch | 55 ------------------- patches/200-fix-build-for-clang20.patch | 33 +++++++++++ 4 files changed, 41 insertions(+), 63 deletions(-) delete mode 100644 patches/025-Add-BPF_LDFLAGS-to-allow-overwriting-llc-s-march-arg.patch create mode 100644 patches/200-fix-build-for-clang20.patch diff --git a/Makefile b/Makefile index 8bce10f..3fbd3e9 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xdp-tools PKG_RELEASE:=1 -PKG_VERSION:=1.4.3 -PKG_HASH:=6e727e2c7c079dec86575c5d0e7aac7ecd582aabe04b3b176d7ef50e653b60c0 +PKG_VERSION:=1.5.1 +PKG_HASH:=aa1119a296412dbf19b50d4250a855ca7a7c56fcfbe0a6c02cd10ab1798f5b75 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/xdp-project/xdp-tools/tar.gz/v$(PKG_VERSION)? @@ -11,6 +11,7 @@ PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_VERSION)) PKG_MAINTAINER:=Daniel Golle +PKG_BUILD_FLAGS:=no-gc-sections no-lto no-mold PKG_BUILD_DEPENDS:=bpf-headers PKG_FLAGS:=nonshared @@ -85,9 +86,8 @@ CONFIGURE_VARS += \ CFLAGS="$(TARGET_CFLAGS)" \ LDFLAGS="$(TARGET_LDFLAGS)" \ CLANG="$(CLANG)" \ - BPF_TARGET="$(BPF_ARCH)-linux-gnu" \ + BPF_TARGET="$(BPF_TARGET)" \ LLC="$(LLVM_LLC)" \ - BPF_LDFLAGS="-march=$(BPF_TARGET) -mcpu=v3" \ BPFTOOL="" ifneq ($(findstring s,$(OPENWRT_VERBOSE)),) @@ -100,7 +100,7 @@ MAKE_VARS += \ define Build/Configure $(call Build/Configure/Default) - echo "BPF_CFLAGS += $(BPF_CFLAGS) -Wno-error -fno-stack-protector" >> $(PKG_BUILD_DIR)/config.mk + echo "BPF_CFLAGS += -I$(BPF_HEADERS_DIR)/tools/lib" >> $(PKG_BUILD_DIR)/config.mk endef define Build/InstallDev diff --git a/patches/010-configure-respect-LDFLAGS.patch b/patches/010-configure-respect-LDFLAGS.patch index 512ef09..931e652 100644 --- a/patches/010-configure-respect-LDFLAGS.patch +++ b/patches/010-configure-respect-LDFLAGS.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -191,7 +191,7 @@ int main(int argc, char **argv) { +@@ -189,7 +189,7 @@ int main(int argc, char **argv) { return 0; } EOF @@ -9,7 +9,7 @@ if [ "$?" -eq "0" ]; then echo "HAVE_PCAP:=y" >>$CONFIG [ -n "$LIBPCAP_CFLAGS" ] && echo 'CFLAGS += ' $LIBPCAP_CFLAGS >> $CONFIG -@@ -267,7 +267,7 @@ int main(int argc, char **argv) { +@@ -265,7 +265,7 @@ int main(int argc, char **argv) { return 0; } EOF @@ -18,7 +18,7 @@ libbpf_err=$($compile_cmd 2>&1) if [ "$?" -eq "0" ]; then echo "HAVE_FEATURES+=${config_var}" >>"$CONFIG" -@@ -345,7 +345,7 @@ int main(int argc, char **argv) { +@@ -343,7 +343,7 @@ int main(int argc, char **argv) { } EOF diff --git a/patches/025-Add-BPF_LDFLAGS-to-allow-overwriting-llc-s-march-arg.patch b/patches/025-Add-BPF_LDFLAGS-to-allow-overwriting-llc-s-march-arg.patch deleted file mode 100644 index d6d592b..0000000 --- a/patches/025-Add-BPF_LDFLAGS-to-allow-overwriting-llc-s-march-arg.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 7b00d4a90af1d7bff50833ffe1216cf59592353a Mon Sep 17 00:00:00 2001 -From: Andre Heider -Date: Wed, 18 Jan 2023 22:42:28 +0100 -Subject: [PATCH] Add BPF_LDFLAGS to allow overwriting llc's -march argument - -The argument to clang's -target isn't necessarily the same as to -llc's -march. - -Analogue to BPF_CFLAGS, introduce BPF_LDFLAGS to allow e.g.: -BPF_TARGET="mipsel-linux-gnu" BPF_LDFLAGS="-march=bpfel -mcpu=v3" - -Signed-off-by: Andre Heider ---- - configure | 2 ++ - lib/common.mk | 2 +- - lib/libxdp/Makefile | 2 +- - 3 files changed, 4 insertions(+), 2 deletions(-) - ---- a/configure -+++ b/configure -@@ -17,10 +17,12 @@ check_opts() - : ${DYNAMIC_LIBXDP:=0} - : ${MAX_DISPATCHER_ACTIONS:=10} - : ${BPF_TARGET:=bpf} -+ : ${BPF_LDFLAGS:=-march=$(BPF_TARGET)} - echo "PRODUCTION:=${PRODUCTION}" >>$CONFIG - echo "DYNAMIC_LIBXDP:=${DYNAMIC_LIBXDP}" >>$CONFIG - echo "MAX_DISPATCHER_ACTIONS:=${MAX_DISPATCHER_ACTIONS}" >>$CONFIG - echo "BPF_TARGET:=${BPF_TARGET}" >>$CONFIG -+ echo "BPF_LDFLAGS:=${BPF_LDFLAGS}" >>$CONFIG - } - - find_tool() ---- a/lib/common.mk -+++ b/lib/common.mk -@@ -118,7 +118,7 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EX - -Werror \ - $(BPF_CFLAGS) \ - -O2 -emit-llvm -c -g -o ${@:.o=.ll} $< -- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll} -+ $(QUIET_LLC)$(LLC) $(BPF_LDFLAGS) -filetype=obj -o $@ ${@:.o=.ll} - - $(BPF_SKEL_H): %.skel.h: %.bpf.o - $(QUIET_GEN)$(BPFTOOL) gen skeleton $< name ${@:.skel.h=} > $@ ---- a/lib/libxdp/Makefile -+++ b/lib/libxdp/Makefile -@@ -145,7 +145,7 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(L - -Werror \ - $(BPF_CFLAGS) \ - -O2 -emit-llvm -c -g -o ${@:.o=.ll} $< -- $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll} -+ $(QUIET_LLC)$(LLC) $(BPF_LDFLAGS) -filetype=obj -o $@ ${@:.o=.ll} - - .PHONY: man - ifeq ($(EMACS),) diff --git a/patches/200-fix-build-for-clang20.patch b/patches/200-fix-build-for-clang20.patch new file mode 100644 index 0000000..d6c48d7 --- /dev/null +++ b/patches/200-fix-build-for-clang20.patch @@ -0,0 +1,33 @@ +--- a/lib/common.mk ++++ b/lib/common.mk +@@ -117,7 +117,7 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EX + -Wno-compare-distinct-pointer-types \ + -Werror \ + $(BPF_CFLAGS) \ +- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $< ++ -O2 -emit-llvm -g -o ${@:.o=.ll} $< + $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll} + + $(BPF_SKEL_H): %.skel.h: %.bpf.o +--- a/lib/libxdp/Makefile ++++ b/lib/libxdp/Makefile +@@ -144,7 +144,7 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(L + -Wno-compare-distinct-pointer-types \ + -Werror \ + $(BPF_CFLAGS) \ +- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $< ++ -O2 -emit-llvm -g -o ${@:.o=.ll} $< + $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll} + + .PHONY: man +--- a/lib/util/Makefile ++++ b/lib/util/Makefile +@@ -27,7 +27,7 @@ $(UTIL_BPF_OBJS): %.o: %.c $(KERN_USER_H + -Wno-pointer-sign \ + -Wno-compare-distinct-pointer-types \ + -Werror \ +- -O2 -emit-llvm -c -g -o ${@:.o=.ll} $< ++ -O2 -emit-llvm -g -o ${@:.o=.ll} $< + $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll} + + $(UTIL_SKEL_H): %.skel.h: %.bpf.o