From bf70fbf7b0dc97fbc97af579954ea81a8df36113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= Date: Thu, 1 May 2025 19:27:57 +0200 Subject: [PATCH] dev-util/bpftool: always build bpf bits with std=gnu11, remove py3.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bpf-toolchain-15 compiler defaults to C23, which fails to compile various kernel headers due to their use of a custom 'bool' type. Explicitly using -std=gnu11 works with both clang and bpf-toolchain. Closes: https://bugs.gentoo.org/955156 Signed-off-by: Holger Hoffstätte Part-of: https://github.com/gentoo/gentoo/pull/41884 Signed-off-by: Sam James --- dev-util/bpftool/bpftool-7.5.0.ebuild | 5 ++++- dev-util/bpftool/bpftool-9999.ebuild | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dev-util/bpftool/bpftool-7.5.0.ebuild b/dev-util/bpftool/bpftool-7.5.0.ebuild index 7b4453ce8657d..5100e685f01d5 100644 --- a/dev-util/bpftool/bpftool-7.5.0.ebuild +++ b/dev-util/bpftool/bpftool-7.5.0.ebuild @@ -5,7 +5,7 @@ EAPI=8 LLVM_COMPAT=( {15..20} ) LLVM_OPTIONAL=1 -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) inherit bash-completion-r1 linux-info llvm-r1 python-any-r1 toolchain-funcs @@ -88,6 +88,9 @@ src_prepare() { # remove hardcoded/unhelpful flags from bpftool sed -i -e '/CFLAGS += -O2/d' -e 's/-W //g' -e 's/-Wextra //g' src/Makefile || die + # always build bpf bits with std=gnu11 for kernel compatibility (bug 955156) + sed -i 's/-fno-stack-protector/& -std=gnu11/g' src/Makefile || die + if ! use clang; then # remove bpf target & add assembly annotations to fix CO-RE feature detection sed -i -e 's/-target bpf/-dA/' src/Makefile.feature || die diff --git a/dev-util/bpftool/bpftool-9999.ebuild b/dev-util/bpftool/bpftool-9999.ebuild index fd1c3aebd4c69..9f08e4d48071f 100644 --- a/dev-util/bpftool/bpftool-9999.ebuild +++ b/dev-util/bpftool/bpftool-9999.ebuild @@ -1,11 +1,11 @@ -# Copyright 2021-2024 Gentoo Authors +# Copyright 2021-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 LLVM_COMPAT=( {15..20} ) LLVM_OPTIONAL=1 -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) inherit bash-completion-r1 linux-info llvm-r1 python-any-r1 toolchain-funcs @@ -88,6 +88,9 @@ src_prepare() { # remove hardcoded/unhelpful flags from bpftool sed -i -e '/CFLAGS += -O2/d' -e 's/-W //g' -e 's/-Wextra //g' src/Makefile || die + # always build bpf bits with std=gnu11 for kernel compatibility (bug 955156) + sed -i 's/-fno-stack-protector/& -std=gnu11/g' src/Makefile || die + if ! use clang; then # remove bpf target & add assembly annotations to fix CO-RE feature detection sed -i -e 's/-target bpf/-dA/' src/Makefile.feature || die