From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9905A158042 for ; Mon, 11 Nov 2024 22:25:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4A545E07FA; Mon, 11 Nov 2024 22:25:46 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 28A32E07FA for ; Mon, 11 Nov 2024 22:25:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2E386335D0F for ; Mon, 11 Nov 2024 22:25:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4D09D1CBF for ; Mon, 11 Nov 2024 22:25:43 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1731363852.43976a379d0df9a41910594f7aa3803066f19439.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftool/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/bpftool/Manifest dev-util/bpftool/bpftool-7.5.0.ebuild dev-util/bpftool/bpftool-9999.ebuild dev-util/bpftool/metadata.xml X-VCS-Directories: dev-util/bpftool/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 43976a379d0df9a41910594f7aa3803066f19439 X-VCS-Branch: master Date: Mon, 11 Nov 2024 22:25:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8373243b-2f09-495c-890a-8568b349625e X-Archives-Hash: 3f8c2e9a61fe9a864732e758b1c0fc7b commit: 43976a379d0df9a41910594f7aa3803066f19439 Author: Holger Hoffstätte applied-asynchrony com> AuthorDate: Mon Nov 11 16:47:50 2024 +0000 Commit: Sam James gentoo org> CommitDate: Mon Nov 11 22:24:12 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43976a37 dev-util/bpftool: add 7.5.0 with USE=clang to select BPF toolchain We still default to using clang for now, but using the GCC-based sys-devel/bpf-toolchain as alternative should work. Closes: https://bugs.gentoo.org/943113 Signed-off-by: Holger Hoffstätte applied-asynchrony.com> Signed-off-by: Sam James gentoo.org> dev-util/bpftool/Manifest | 1 + .../{bpftool-9999.ebuild => bpftool-7.5.0.ebuild} | 24 +++++++++++++++++++--- dev-util/bpftool/bpftool-9999.ebuild | 24 +++++++++++++++++++--- dev-util/bpftool/metadata.xml | 1 + 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest index bd595253b010..6c700f9b60d0 100644 --- a/dev-util/bpftool/Manifest +++ b/dev-util/bpftool/Manifest @@ -1,4 +1,5 @@ DIST bpftool-7.4.0.tar.gz 472915 BLAKE2B ae7b6bc6cb742712981ba8972bcecccc63d440b2a77c5a14f91ba5106c013774313d65fd3f42b843ba4027ab17cf9d44d256270f7f8ad11907714f16f3149078 SHA512 08a3095b37a9b897400f2be7dbb9de10d129ae4eef193d03955fdf84017cd3a5d7419e856aa68a425e609419868e8b1dd5409b4f218cc24feeb059c1898cdff4 +DIST bpftool-libbpf-v7.5.0-sources.tar.gz 1510032 BLAKE2B cc9beac4034317f89ae3c1088d1b1a1948778bcdb51d7ed7f566e4e5ab720c1128ca467d51d0bc3ffe7b1f69800249362baef5dfaf858275050f96b744fdbca6 SHA512 db12c305b77fea3689dbc1ce94527f0f21fa9de21fcdb36385e3fe492137335bb393f90e456c06601495ccc984230a531c432709db6514b545e0aeeda7ca3c99 DIST libbpf-1.4.7.tar.gz 1016441 BLAKE2B 10be52c7e97b2f08edd33cb263c4737bb52edfd2226f0c5b86d4f95b584b81f8f6b1ede469e9ad6c231e55b6d6b9a038160662606c3f30dc79b1336aaaa90e74 SHA512 f09ff28ac75b0d0c1bfe7d233aee6a00e5c21f185646b2afe11b7bd048d74962f893237437dd81a762768f9235b9f2a2a33cb297201b2aa3e98f7c6f58e5b365 DIST linux-6.10.tar.xz 145142812 BLAKE2B bb243ea7493b9d63aa2df2050a3f1ae2b89ee84a20015239cf157e3f4f51c7ac5efedc8a51132b2d7482f9276ac418de6624831c8a3b806130d9c2d2124c539b SHA512 baa2487954044f991d2ae254d77d14a1f0185dd62c9f0fcaff69f586c9f906823017b8db1c4588f27b076dfa3ebb606929fec859f60ea419e7974330b9289cc2 DIST linux-6.11.tar.xz 146900704 BLAKE2B e7750c0878d71a56a0ce52d4c4c912199dad5bf5e2e8f872585a6494afbb37cbd852e612a6858936d2dc9b7776a3933818f540db408d57e90d18ea5249bba7ab SHA512 329c1f94008742e3f0c2ce7e591a16316d1b2cb9ea4596d4f45604097e07b7aa2f64afa40630a07f321a858455c77aa32ba57b271932ddcf4dc27863f9081cea diff --git a/dev-util/bpftool/bpftool-9999.ebuild b/dev-util/bpftool/bpftool-7.5.0.ebuild similarity index 82% copy from dev-util/bpftool/bpftool-9999.ebuild copy to dev-util/bpftool/bpftool-7.5.0.ebuild index b375bf2b057e..484a512181cf 100644 --- a/dev-util/bpftool/bpftool-9999.ebuild +++ b/dev-util/bpftool/bpftool-7.5.0.ebuild @@ -41,7 +41,7 @@ fi LICENSE="|| ( GPL-2 BSD-2 )" SLOT="0" -IUSE="caps llvm" +IUSE="caps +clang llvm" REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )" RDEPEND=" @@ -59,7 +59,8 @@ BDEPEND=" ${PYTHON_DEPS} app-arch/tar dev-python/docutils - $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') + clang? ( $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') ) + !clang? ( sys-devel/bpf-toolchain ) " CONFIG_CHECK="~DEBUG_INFO_BTF" @@ -87,16 +88,33 @@ 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 + 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 + + # remove bpf target from skeleton build + sed -i -e 's/--target=bpf//g' src/Makefile || die + fi + # Use rst2man or rst2man.py depending on which one exists (#930076) type -P rst2man >/dev/null || sed -i -e 's/rst2man/rst2man.py/g' docs/Makefile || die } bpftool_make() { + # which BPF compiler should we use? + if use clang; then + export CLANG="$(get_llvm_prefix -b)/bin/clang" + export LLVM_STRIP="$(get_llvm_prefix -b)/bin/llvm-strip" + else + # use bpf-toolchain + export CLANG="bpf-unknown-none-gcc" + export LLVM_STRIP="bpf-unknown-none-strip" + fi + tc-export AR CC LD emake \ ARCH="$(tc-arch-kernel)" \ - CLANG="$(get_llvm_prefix -b)/bin/clang" \ HOSTAR="$(tc-getBUILD_AR)" \ HOSTCC="$(tc-getBUILD_CC)" \ HOSTLD="$(tc-getBUILD_LD)" \ diff --git a/dev-util/bpftool/bpftool-9999.ebuild b/dev-util/bpftool/bpftool-9999.ebuild index b375bf2b057e..484a512181cf 100644 --- a/dev-util/bpftool/bpftool-9999.ebuild +++ b/dev-util/bpftool/bpftool-9999.ebuild @@ -41,7 +41,7 @@ fi LICENSE="|| ( GPL-2 BSD-2 )" SLOT="0" -IUSE="caps llvm" +IUSE="caps +clang llvm" REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )" RDEPEND=" @@ -59,7 +59,8 @@ BDEPEND=" ${PYTHON_DEPS} app-arch/tar dev-python/docutils - $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') + clang? ( $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') ) + !clang? ( sys-devel/bpf-toolchain ) " CONFIG_CHECK="~DEBUG_INFO_BTF" @@ -87,16 +88,33 @@ 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 + 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 + + # remove bpf target from skeleton build + sed -i -e 's/--target=bpf//g' src/Makefile || die + fi + # Use rst2man or rst2man.py depending on which one exists (#930076) type -P rst2man >/dev/null || sed -i -e 's/rst2man/rst2man.py/g' docs/Makefile || die } bpftool_make() { + # which BPF compiler should we use? + if use clang; then + export CLANG="$(get_llvm_prefix -b)/bin/clang" + export LLVM_STRIP="$(get_llvm_prefix -b)/bin/llvm-strip" + else + # use bpf-toolchain + export CLANG="bpf-unknown-none-gcc" + export LLVM_STRIP="bpf-unknown-none-strip" + fi + tc-export AR CC LD emake \ ARCH="$(tc-arch-kernel)" \ - CLANG="$(get_llvm_prefix -b)/bin/clang" \ HOSTAR="$(tc-getBUILD_AR)" \ HOSTCC="$(tc-getBUILD_CC)" \ HOSTLD="$(tc-getBUILD_LD)" \ diff --git a/dev-util/bpftool/metadata.xml b/dev-util/bpftool/metadata.xml index 1e8c354ad0e2..9f8d8d0dc0a8 100644 --- a/dev-util/bpftool/metadata.xml +++ b/dev-util/bpftool/metadata.xml @@ -11,6 +11,7 @@ Use sys-libs/libcap to enable unprivileged run support + Use sys-devel/clang instead of sys-devel/bpf-toolchain for BPF CO-RE support Use sys-devel/llvm instead of libbfd (sys-libs/binutils-libs) for JIT disassembly