Merge Official Source

This commit is contained in:
actions-user
2025-11-26 16:30:01 +08:00
parent 57c5307fca
commit 57f84a75b2
4 changed files with 41 additions and 63 deletions

View File

@@ -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 <daniel@makrotopia.org>
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

View File

@@ -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

View File

@@ -1,55 +0,0 @@
From 7b00d4a90af1d7bff50833ffe1216cf59592353a Mon Sep 17 00:00:00 2001
From: Andre Heider <a.heider@gmail.com>
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 <a.heider@gmail.com>
---
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),)

View File

@@ -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