commit:     8eea55ff639c63ce54f5feba1d3300e40d4814b9
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sat Mar  4 15:16:10 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  5 11:19:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8eea55ff

net-libs/xdp-tools: bump to 1.3.1 & add build fixes

- fix configure to properly detect libbpf features
- fix clang build with default-enabled stack protector

Closes: https://bugs.gentoo.org/889842
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/29926
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-libs/xdp-tools/Manifest                        |  2 +-
 .../files/1.3.1-disable-stack-protector.patch      | 32 +++++++++++++++++++
 .../files/1.3.1-fix-btf__type_cnt-detection.patch  | 36 ++++++++++++++++++++++
 ...p-tools-1.2.8.ebuild => xdp-tools-1.3.1.ebuild} |  7 ++++-
 4 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/net-libs/xdp-tools/Manifest b/net-libs/xdp-tools/Manifest
index 9e3d03e1cffd..2fda18e4cc09 100644
--- a/net-libs/xdp-tools/Manifest
+++ b/net-libs/xdp-tools/Manifest
@@ -1 +1 @@
-DIST xdp-tools-1.2.8.tar.gz 253786 BLAKE2B 
f745085b73da5193c3cdaf60c20dfa5de62f3d83487413c87b4c3d07b755dcf91cfbeb4ba970b4e04eef74b4cec4238057f4462074f49b7139d7652cb0f22998
 SHA512 
6ada9e433fcbefd13cebdffe93c3ce9159e9e09f1498d1615918ca6ecc4f11f03fcd9096980e8ceb7de126d4d8b953fa64917e777d54b5a3dfd1a9556de81626
+DIST xdp-tools-1.3.1.tar.gz 330516 BLAKE2B 
89a61f47ba26efe6d0630d971e913e034d111d05c896e5af1bb28e6cb4e94133e6ecd827a10ee12a935ae2e6856f04556ac564ded1bcc65182766d656f8d0c5f
 SHA512 
9dd434095a043158d14fb6829fa632fc4a0714dc0b6e08c219dfb55cb9f34005300db750115e08bd54210e90142bd499904616da077b8aa827e4de28c31be637

diff --git a/net-libs/xdp-tools/files/1.3.1-disable-stack-protector.patch 
b/net-libs/xdp-tools/files/1.3.1-disable-stack-protector.patch
new file mode 100644
index 000000000000..3a37b26efa14
--- /dev/null
+++ b/net-libs/xdp-tools/files/1.3.1-disable-stack-protector.patch
@@ -0,0 +1,32 @@
+
+From: 
https://github.com/xdp-project/xdp-tools/commit/cb6d06219d1b49b07980b481a383e1dea74a0702
+Bug: https://bugs.gentoo.org/889842
+
+From cb6d06219d1b49b07980b481a383e1dea74a0702 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <[email protected]>
+Date: Sat, 4 Mar 2023 20:08:25 +0100
+Subject: [PATCH] make: disable stack protector for BPF bits built by clang
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The clang toolchain might have stack-protection enabled by default
+(e.g. via platform configuration) and that won't work for BPF,
+so unconfitionally disable it via -fno-stack-protector.
+
+Signed-off-by: Holger Hoffstätte <[email protected]>
+---
+ lib/defines.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/defines.mk b/lib/defines.mk
+index f134c43b..54b259f2 100644
+--- a/lib/defines.mk
++++ b/lib/defines.mk
+@@ -1,5 +1,5 @@
+ CFLAGS ?= -O2 -g
+-BPF_CFLAGS ?= -Wno-visibility
++BPF_CFLAGS ?= -Wno-visibility -fno-stack-protector
+ BPF_TARGET ?= bpf
+ 
+ HAVE_FEATURES :=

diff --git a/net-libs/xdp-tools/files/1.3.1-fix-btf__type_cnt-detection.patch 
b/net-libs/xdp-tools/files/1.3.1-fix-btf__type_cnt-detection.patch
new file mode 100644
index 000000000000..d805e1077c76
--- /dev/null
+++ b/net-libs/xdp-tools/files/1.3.1-fix-btf__type_cnt-detection.patch
@@ -0,0 +1,36 @@
+
+From 
https://github.com/xdp-project/xdp-tools/commit/a7df567634af77381832a2212c5f5099b07734f3
+
+From a7df567634af77381832a2212c5f5099b07734f3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <[email protected]>
+Date: Sat, 4 Mar 2023 20:07:39 +0100
+Subject: [PATCH] configure: Fix function detection for btf__type_cnt()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The configure check for btf__type_cnt() swapped two arguments in the
+check_libbpf_function() call in the configure script, leading to the check
+failing if LIBBPF_CFLAGS is non-empty. Make sure the arguments are in the
+right order, and also pass a proper NULL parameter in the check instead of
+a 0.
+
+Reported-by: Holger Hoffstätte <[email protected]>
+Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 016c5bbd..62c2f883 100755
+--- a/configure
++++ b/configure
+@@ -272,7 +272,7 @@ check_libbpf_functions()
+ 
+     check_libbpf_function "perf_buffer__consume" "(NULL)" "" "$LIBBPF_CFLAGS" 
"$LIBBPF_LDLIBS"
+     check_libbpf_function "btf__load_from_kernel_by_id" "(0)" "" 
"$LIBBPF_CFLAGS" "$LIBBPF_LDLIBS"
+-    check_libbpf_function "btf__type_cnt" "(0)" "$LIBBPF_CFLAGS" "" 
"$LIBBPF_LDLIBS"
++    check_libbpf_function "btf__type_cnt" "(NULL)" "" "$LIBBPF_CFLAGS" 
"$LIBBPF_LDLIBS"
+     check_libbpf_function "bpf_object__next_map" "(NULL, NULL)" "" 
"$LIBBPF_CFLAGS" "$LIBBPF_LDLIBS"
+     check_libbpf_function "bpf_object__next_program" "(NULL, NULL)" "" 
"$LIBBPF_CFLAGS" "$LIBBPF_LDLIBS"
+     check_libbpf_function "bpf_program__insn_cnt" "(NULL)" "" 
"$LIBBPF_CFLAGS" "$LIBBPF_LDLIBS"

diff --git a/net-libs/xdp-tools/xdp-tools-1.2.8.ebuild 
b/net-libs/xdp-tools/xdp-tools-1.3.1.ebuild
similarity index 88%
rename from net-libs/xdp-tools/xdp-tools-1.2.8.ebuild
rename to net-libs/xdp-tools/xdp-tools-1.3.1.ebuild
index 0dd14f1dc39b..fdc4068a030e 100644
--- a/net-libs/xdp-tools/xdp-tools-1.2.8.ebuild
+++ b/net-libs/xdp-tools/xdp-tools-1.3.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2021-2022 Gentoo Authors
+# Copyright 2021-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,11 @@ QA_PREBUILT="usr/lib/bpf/*.o"
 
 MAKEOPTS+=" V=1"
 
+PATCHES=(
+       "${FILESDIR}"/1.3.1-disable-stack-protector.patch
+       "${FILESDIR}"/1.3.1-fix-btf__type_cnt-detection.patch
+)
+
 src_configure() {
        export PRODUCTION=1
        export DYNAMIC_LIBXDP=1

Reply via email to