dev-util/bpftool: always build bpf bits with std=gnu11, remove py3.10

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 <holger@applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/41884
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Holger Hoffstätte
2025-05-02 05:37:27 +01:00
committed by Sam James
parent 369868bc73
commit bf70fbf7b0
2 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -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
+5 -2
View File
@@ -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