public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2020-02-15 16:05 Yixun Lan
  0 siblings, 0 replies; 9+ messages in thread
From: Yixun Lan @ 2020-02-15 16:05 UTC (permalink / raw
  To: gentoo-commits

commit:     95244db839bb931271d1b430c0b39ef482e6b0f5
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 15 16:01:22 2020 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Sat Feb 15 16:04:23 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95244db8

dev-util/perf: make perf build with both old and new libbfd

patch from upstream, this would make it build with binutils-2.34 again

Closes: https://bugs.gentoo.org/707830
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 dev-util/perf/Manifest                             |   1 +
 .../perf/files/perf-5.4.20-binutil-libs-2.34.patch |  60 +++++
 dev-util/perf/perf-5.4.20.ebuild                   | 246 +++++++++++++++++++++
 3 files changed, 307 insertions(+)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index 11d1946d67e..38f95eb78e3 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -5,4 +5,5 @@ DIST linux-5.4.tar.xz 109441440 BLAKE2B 193bc4a3147e147d5529956164ec4912fad5d5c6
 DIST patch-4.14.33.xz 905284 BLAKE2B e67bd9a96708aaaf65eb0aa852493b2323c9e237bfcc6fa837f795e481943ead3e2d5005ee72e40fc247df01c50877d9da3848a05aba3c999c3cfb7678cbdbc9 SHA512 5c76be5171709c2df7df7d5a8e8f3d0f7ede47b433da3b0f1710f262c8fcf5cf6c744a96d4336ea397c2c88a5f0a7507a5ab08c7c82f08deeb7a6f887ad77cfd
 DIST patch-4.20.3.xz 91732 BLAKE2B bf99271bcb35508df239343fd6c9d57c246f88320b586e44e2d97771d08b249a24db230214d4957015a5ed35261e201f0680101b99d0e92f0f1f69bc53e21458 SHA512 47178b8e3bfe4ba09cb82bb1ce8b0742e6749d4be3412fb57518918f7109e74eac1d3d8eb32a43e21b3837a14f37d5eefd8cab819defd10cc2db61fb0ceddeaf
 DIST patch-5.3.7.xz 255616 BLAKE2B 18ec40508fdb2cc17dd927f3ddef07b2b744ff993de75bb7adebe3a3f97c9383ea1845085899aa939ca8a15515420c18a1ac0ae832f9ae52f18cc8ed59a1e75f SHA512 bf2717b721b3acfd423537a6a520388e6a596ae65605ed8c029a67c117a002e9a21c324de0dd41407bfdc8ef95263687764f4f46aa59cbb50f68ab21b96c29d6
+DIST patch-5.4.20.xz 776552 BLAKE2B bad2a95ed8521ac5c379fe91e16d60b2a38de19b9239755084621e5230677b232ec4cf9e2e8161c0022daff43fdbb37d5b5b5bfdc9e932ef3a860bcd17f640f8 SHA512 65fbcdbd41e35c17601ff15bbe33933be2ab7a694aa181a0b802cc11c1c653c9b688dbb382076cbad05983a0c07467955c035ae25f5175f7ce5bc24339303d77
 DIST patch-5.4.7.xz 272092 BLAKE2B dc9e1cede993144a4d9cb17cb91d3857b6492fa1a971c743268afdc601edfafb033abc3ac24cb7789d3f171ea7fb6b60ad5197da445ab72f5e9cf2ae00e7f495 SHA512 396eaf9fe88045e6e308cbe8e72217b3334b637bfa7e85f8d27cc4dd8e3d94c6f58d2b7b3e237defcf647d500610b85780ec2e21f1d91ac41c5f4ef3e74dc161

diff --git a/dev-util/perf/files/perf-5.4.20-binutil-libs-2.34.patch b/dev-util/perf/files/perf-5.4.20-binutil-libs-2.34.patch
new file mode 100644
index 00000000000..9fa191f720a
--- /dev/null
+++ b/dev-util/perf/files/perf-5.4.20-binutil-libs-2.34.patch
@@ -0,0 +1,60 @@
+From 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015 Mon Sep 17 00:00:00 2001
+From: Changbin Du <changbin.du@gmail.com>
+Date: Tue, 28 Jan 2020 23:29:38 +0800
+Subject: perf: Make perf able to build with latest libbfd
+
+libbfd has changed the bfd_section_* macros to inline functions
+bfd_section_<field> since 2019-09-18. See below two commits:
+  o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
+  o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
+
+This fix make perf able to build with both old and new libbfd.
+
+Signed-off-by: Changbin Du <changbin.du@gmail.com>
+Acked-by: Jiri Olsa <jolsa@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lore.kernel.org/lkml/20200128152938.31413-1-changbin.du@gmail.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+---
+ tools/perf/util/srcline.c | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
+index 6ccf6f6..5b7d6c1 100644
+--- a/tools/perf/util/srcline.c
++++ b/tools/perf/util/srcline.c
+@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
+ 	bfd_vma pc, vma;
+ 	bfd_size_type size;
+ 	struct a2l_data *a2l = data;
++	flagword flags;
+ 
+ 	if (a2l->found)
+ 		return;
+ 
+-	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
++#ifdef bfd_get_section_flags
++	flags = bfd_get_section_flags(abfd, section);
++#else
++	flags = bfd_section_flags(section);
++#endif
++	if ((flags & SEC_ALLOC) == 0)
+ 		return;
+ 
+ 	pc = a2l->addr;
++#ifdef bfd_get_section_vma
+ 	vma = bfd_get_section_vma(abfd, section);
++#else
++	vma = bfd_section_vma(section);
++#endif
++#ifdef bfd_get_section_size
+ 	size = bfd_get_section_size(section);
++#else
++	size = bfd_section_size(section);
++#endif
+ 
+ 	if (pc < vma || pc >= vma + size)
+ 		return;
+-- 
+cgit v1.1
+

diff --git a/dev-util/perf/perf-5.4.20.ebuild b/dev-util/perf/perf-5.4.20.ebuild
new file mode 100644
index 00000000000..3075642225a
--- /dev/null
+++ b/dev-util/perf/perf-5.4.20.ebuild
@@ -0,0 +1,246 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{6,7} )
+inherit bash-completion-r1 estack eutils toolchain-funcs python-r1 linux-info
+
+MY_PV="${PV/_/-}"
+MY_PV="${MY_PV/-pre/-git}"
+
+DESCRIPTION="Userland tools for Linux Performance Counters"
+HOMEPAGE="https://perf.wiki.kernel.org/"
+
+LINUX_V="${PV:0:1}.x"
+if [[ ${PV} == *_rc* ]] ; then
+	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
+	PATCH_VERSION=$(ver_cut 1-3)
+	LINUX_PATCH=patch-${PV//_/-}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
+		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
+elif [[ ${PV} == *.*.* ]] ; then
+	# stable-release series
+	LINUX_VER=$(ver_cut 1-2)
+	LINUX_PATCH=patch-${PV}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
+else
+	LINUX_VER=${PV}
+	SRC_URI=""
+fi
+
+LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
+SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="audit clang crypt debug +demangle +doc gtk java lzma numa perl python slang systemtap unwind zlib"
+# TODO babeltrace
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="audit? ( sys-process/audit )
+	crypt? ( dev-libs/openssl:0= )
+	clang? (
+		sys-devel/clang:*
+		sys-devel/llvm:*
+	)
+	demangle? ( sys-libs/binutils-libs:= )
+	gtk? ( x11-libs/gtk+:2 )
+	java? ( virtual/jre:* )
+	lzma? ( app-arch/xz-utils )
+	numa? ( sys-process/numactl )
+	perl? ( dev-lang/perl:= )
+	python? ( ${PYTHON_DEPS} )
+	slang? ( sys-libs/slang )
+	systemtap? ( dev-util/systemtap )
+	unwind? ( sys-libs/libunwind )
+	zlib? ( sys-libs/zlib )
+	dev-libs/elfutils"
+DEPEND="${RDEPEND}
+	>=sys-kernel/linux-headers-4.19
+	${LINUX_PATCH+dev-util/patchutils}
+	sys-devel/bison
+	sys-devel/flex
+	java? ( virtual/jdk )
+	doc? (
+		app-text/asciidoc
+		app-text/sgml-common
+		app-text/xmlto
+		sys-process/time
+	)"
+
+S_K="${WORKDIR}/linux-${LINUX_VER}"
+S="${S_K}/tools/perf"
+
+CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
+
+src_unpack() {
+	local paths=(
+		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
+		include lib "arch/*/lib"
+	)
+
+	# We expect the tar implementation to support the -j option (both
+	# GNU tar and libarchive's tar support that).
+	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
+	tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
+		"${paths[@]/#/linux-${LINUX_VER}/}" || die
+
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		eshopts_push -o noglob
+		ebegin "Filtering partial source patch"
+		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
+			> ${P}.patch
+		eend $? || die "filterdiff failed"
+		eshopts_pop
+	fi
+
+	local a
+	for a in ${A}; do
+		[[ ${a} == ${LINUX_SOURCES} ]] && continue
+		[[ ${a} == ${LINUX_PATCH} ]] && continue
+		unpack ${a}
+	done
+
+	# support clang8
+	echo $(clang-major-version)
+	if use clang; then
+		local old_CC=${CC}
+		CC=${CHOST}-clang
+		if [[ $(clang-major-version) -ge 8 ]]; then
+			pushd "${S_K}" >/dev/null || die
+			eapply \
+				"${FILESDIR}/perf-5.1.15-fix-clang8.patch" \
+				"${FILESDIR}/perf-5.4.6-fix-clang9.patch"
+			popd || die
+		fi
+		CC=${old_CC}
+	fi
+
+	pushd "${S_K}" >/dev/null || die
+	eapply "${FILESDIR}/perf-5.4.7-propagate-cflags.patch"
+	eapply "${FILESDIR}/perf-5.4.20-binutil-libs-2.34.patch"
+	popd || die
+}
+
+src_prepare() {
+	default
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		pushd "${S_K}" >/dev/null || die
+		eapply "${WORKDIR}"/${P}.patch
+		popd || die
+	fi
+
+	# Drop some upstream too-developer-oriented flags and fix the
+	# Makefile in general
+	sed -i \
+		-e "s:\$(sysconfdir_SQ)/bash_completion.d:$(get_bashcompdir):" \
+		"${S}"/Makefile.perf || die
+	# A few places still use -Werror w/out $(WERROR) protection.
+	sed -i -e 's:-Werror::' \
+		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
+
+	# Avoid the call to make kernelversion
+	echo "#define PERF_VERSION \"${MY_PV}\"" > PERF-VERSION-FILE
+
+	# The code likes to compile local assembly files which lack ELF markings.
+	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
+}
+
+puse() { usex $1 "" no; }
+perf_make() {
+	# The arch parsing is a bit funky.  The perf tools package is integrated
+	# into the kernel, so it wants an ARCH that looks like the kernel arch,
+	# but it also wants to know about the split value -- i386/x86_64 vs just
+	# x86.  We can get that by telling the func to use an older linux version.
+	# It's kind of a hack, but not that bad ...
+
+	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
+
+	local arch=$(tc-arch-kernel)
+	local java_dir
+	use java && java_dir="/etc/java-config-2/current-system-vm"
+	# FIXME: NO_CORESIGHT
+	# FIXME: NO_LIBBABELTRACE
+	emake V=1 VF=1 \
+		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" \
+		prefix="${EPREFIX}/usr" bindir_relative="bin" \
+		EXTRA_CFLAGS="${CFLAGS}" \
+		ARCH="${arch}" \
+		JDIR="${java_dir}" \
+		LIBCLANGLLVM=$(usex clang 1 "") \
+		NO_AUXTRACE="" \
+		NO_BACKTRACE="" \
+		NO_CORESIGHT=1 \
+		NO_DEMANGLE=$(puse demangle) \
+		NO_GTK2=$(puse gtk) \
+		NO_JVMTI=$(puse java) \
+		NO_LIBAUDIT=$(puse audit) \
+		NO_LIBBABELTRACE=1 \
+		NO_LIBBIONIC=1 \
+		NO_LIBBPF="" \
+		NO_LIBCRYPTO=$(puse crypt) \
+		NO_LIBDW_DWARF_UNWIND="" \
+		NO_LIBELF="" \
+		NO_LIBNUMA=$(puse numa) \
+		NO_LIBPERL=$(puse perl) \
+		NO_LIBPYTHON=$(puse python) \
+		NO_LIBUNWIND=$(puse unwind) \
+		NO_SDT=$(puse systemtap) \
+		NO_SLANG=$(puse slang) \
+		NO_LZMA=$(puse lzma) \
+		NO_ZLIB= \
+		WERROR=0 \
+		LIBDIR="/usr/libexec/perf-core" \
+		"$@"
+}
+
+src_compile() {
+	# test-clang.bin not build with g++
+	if use clang; then
+		pushd "${S_K}/tools/build/feature/" || die
+		make V=1 CXX=${CHOST}-clang++ test-clang.bin || die
+		popd
+	fi
+	perf_make -f Makefile.perf
+	use doc && perf_make -C Documentation
+}
+
+src_test() {
+	:
+}
+
+src_install() {
+	_install_python_ext() {
+		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
+	}
+
+	perf_make -f Makefile.perf install DESTDIR="${D}"
+	if use python; then
+		python_foreach_impl _install_python_ext
+	fi
+
+	rm -rv "${ED}"/usr/share/doc/perf-tip || die
+
+	if use gtk; then
+		mv "${ED}"/usr/$(get_libdir)/libperf-gtk.so \
+			"${ED}"/usr/libexec/perf-core || die
+	fi
+
+	dodoc CREDITS
+
+	dodoc *txt Documentation/*.txt
+	if use doc ; then
+		HTML_DOCS="Documentation/*.html" einstalldocs
+		doman Documentation/*.1
+	fi
+}
+
+pkg_postinst() {
+	if ! use doc ; then
+		elog "Without the doc USE flag you won't get any documentation nor man pages."
+		elog "And without man pages, you won't get any --help output for perf and its"
+		elog "sub-tools."
+	fi
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2021-11-11  8:56 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2021-11-11  8:56 UTC (permalink / raw
  To: gentoo-commits

commit:     322b4e15ef689afbf118da25f4788070d25d4a75
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 11 08:49:02 2021 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Thu Nov 11 08:51:41 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=322b4e15

dev-util/perf: support LLVM >= 10, bug #735752

Closes: https://bugs.gentoo.org/735752
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/files/perf-5.15-clang.patch          | 231 +++++++++++++++++++++
 .../perf/{perf-5.15.ebuild => perf-5.15-r1.ebuild} |  16 +-
 2 files changed, 241 insertions(+), 6 deletions(-)

diff --git a/dev-util/perf/files/perf-5.15-clang.patch b/dev-util/perf/files/perf-5.15-clang.patch
new file mode 100644
index 00000000000..5ea0c75f27f
--- /dev/null
+++ b/dev-util/perf/files/perf-5.15-clang.patch
@@ -0,0 +1,231 @@
+From e1f1cbfe812e4a019034105ab5e81fd9f0742353 Mon Sep 17 00:00:00 2001
+From: Ian Rogers <irogers@google.com>
+Date: Mon, 11 Oct 2021 19:13:20 -0700
+Subject: [PATCH 1/3] tools: Bump minimum LLVM C++ std to GNU++14
+
+LLVM 9 (current release is LLVM 13) moved the minimum C++ version to
+GNU++14. Bump the version numbers in the feature test and perf build.
+
+Reviewed-by: Fangrui Song <maskray@google.com>
+Signed-off-by: Ian Rogers <irogers@google.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Leo Yan <leo.yan@linaro.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Michael Petlan <mpetlan@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Cc: Nick Desaulniers <ndesaulniers@google.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Sedat Dilek <sedat.dilek@gmail.com>
+Cc: llvm@lists.linux.dev
+Link: https://lore.kernel.org/r/20211012021321.291635-1-irogers@google.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+---
+ tools/build/feature/Makefile | 6 +++---
+ tools/perf/Makefile.config   | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
+index eff55d287db1..9756e589e4ae 100644
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -296,7 +296,7 @@ $(OUTPUT)test-jvmti-cmlr.bin:
+ 	$(BUILD)
+ 
+ $(OUTPUT)test-llvm.bin:
+-	$(BUILDXX) -std=gnu++11 				\
++	$(BUILDXX) -std=gnu++14 				\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+ 		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
+@@ -304,12 +304,12 @@ $(OUTPUT)test-llvm.bin:
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+ $(OUTPUT)test-llvm-version.bin:
+-	$(BUILDXX) -std=gnu++11 				\
++	$(BUILDXX) -std=gnu++14					\
+ 		-I$(shell $(LLVM_CONFIG) --includedir)		\
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+ $(OUTPUT)test-clang.bin:
+-	$(BUILDXX) -std=gnu++11 				\
++	$(BUILDXX) -std=gnu++14					\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+ 		-Wl,--start-group -lclangBasic -lclangDriver	\
+diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
+index 14e3e8d702a0..ddbe86defe39 100644
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -285,7 +285,7 @@ CORE_CFLAGS += -Wall
+ CORE_CFLAGS += -Wextra
+ CORE_CFLAGS += -std=gnu99
+ 
+-CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
++CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
+ CXXFLAGS += -Wall
+ CXXFLAGS += -fno-omit-frame-pointer
+ CXXFLAGS += -ggdb3
+-- 
+2.33.1
+
+
+From 3e5c11995e04a9e3351330c34c4c802ce50df46c Mon Sep 17 00:00:00 2001
+From: Ian Rogers <irogers@google.com>
+Date: Mon, 11 Oct 2021 19:13:21 -0700
+Subject: [PATCH 2/3] perf clang: Fixes for more recent LLVM/clang
+
+The parameters to two functions and the location of a variable have
+changed in more recent LLVM/clang releases.
+
+Remove the unneecessary -fmessage-length and -ferror-limit flags, the
+former causes failures like:
+
+  58: builtin clang support                                           :
+  58.1: builtin clang compile C source to IR                          :
+  --- start ---
+  test child forked, pid 279307
+  error: unknown argument: '-fmessage-length'
+  1 error generated.
+  test child finished with -1
+
+Tested with LLVM 6, 8, 9, 10 and 11.
+
+Reviewed-by: Fangrui Song <maskray@google.com>
+Signed-off-by: Ian Rogers <irogers@google.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Leo Yan <leo.yan@linaro.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Michael Petlan <mpetlan@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Cc: Nick Desaulniers <ndesaulniers@google.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Sedat Dilek <sedat.dilek@gmail.com>,
+Cc: llvm@lists.linux.dev
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+---
+ tools/perf/util/c++/clang.cpp | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
+index c8885dfa3667..df7b18fb6b6e 100644
+--- a/tools/perf/util/c++/clang.cpp
++++ b/tools/perf/util/c++/clang.cpp
+@@ -43,8 +43,6 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
+ 		"-cc1",
+ 		"-triple", "bpf-pc-linux",
+ 		"-fsyntax-only",
+-		"-ferror-limit", "19",
+-		"-fmessage-length", "127",
+ 		"-O2",
+ 		"-nostdsysteminc",
+ 		"-nobuiltininc",
+@@ -55,7 +53,11 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
+ 		"-x", "c"};
+ 
+ 	CCArgs.append(CFlags.begin(), CFlags.end());
+-	CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs);
++	CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs
++#if CLANG_VERSION_MAJOR >= 11
++                                                        ,/*BinaryName=*/nullptr
++#endif
++                                                        );
+ 
+ 	FrontendOptions& Opts = CI->getFrontendOpts();
+ 	Opts.Inputs.clear();
+@@ -151,13 +153,16 @@ getBPFObjectFromModule(llvm::Module *Module)
+ 
+ 	legacy::PassManager PM;
+ 	bool NotAdded;
+-#if CLANG_VERSION_MAJOR < 7
+-	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
+-						      TargetMachine::CGFT_ObjectFile);
++	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream
++#if CLANG_VERSION_MAJOR >= 7
++                                                      , /*DwoOut=*/nullptr
++#endif
++#if CLANG_VERSION_MAJOR < 10
++                                                      , TargetMachine::CGFT_ObjectFile
+ #else
+-	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
+-						      TargetMachine::CGFT_ObjectFile);
++                                                      , llvm::CGFT_ObjectFile
+ #endif
++                                                      );
+ 	if (NotAdded) {
+ 		llvm::errs() << "TargetMachine can't emit a file of this type\n";
+ 		return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);
+-- 
+2.33.1
+
+
+From aa2b4e5e920cbaadc0fed9b8aa7c4498feee3dd5 Mon Sep 17 00:00:00 2001
+From: Guilherme Amadio <amadio@cern.ch>
+Date: Thu, 29 Apr 2021 13:44:48 +0200
+Subject: [PATCH 3/3] tools feature: update LLVM/Clang detection
+
+Since LLVM/Clang 10, individual libraries have been merged into
+monolithic libraries libLLVM.so, libclang.so, and libclang-cpp.so.
+---
+ tools/build/feature/Makefile | 8 +++-----
+ tools/perf/Makefile.perf     | 7 ++-----
+ 2 files changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
+index 9756e589e4ae..23478bd06093 100644
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -299,7 +299,7 @@ $(OUTPUT)test-llvm.bin:
+ 	$(BUILDXX) -std=gnu++14 				\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+-		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
++		$(shell $(LLVM_CONFIG) --libs)			\
+ 		$(shell $(LLVM_CONFIG) --system-libs)		\
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+@@ -312,11 +312,9 @@ $(OUTPUT)test-clang.bin:
+ 	$(BUILDXX) -std=gnu++14					\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+-		-Wl,--start-group -lclangBasic -lclangDriver	\
+-		  -lclangFrontend -lclangEdit -lclangLex	\
+-		  -lclangAST -Wl,--end-group 			\
+-		$(shell $(LLVM_CONFIG) --libs Core option)	\
++		$(shell $(LLVM_CONFIG) --libs)			\
+ 		$(shell $(LLVM_CONFIG) --system-libs)		\
++		-lclang-cpp					\
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+ -include $(OUTPUT)*.d
+diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
+index b856afa6eb52..d0ff0ddf9c18 100644
+--- a/tools/perf/Makefile.perf
++++ b/tools/perf/Makefile.perf
+@@ -410,14 +410,11 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
+ LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+ 
+ ifeq ($(USE_CLANG), 1)
+-  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
+-  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
+-  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
+-  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
++  LIBS += -lclang-cpp
+ endif
+ 
+ ifeq ($(USE_LLVM), 1)
+-  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
++  LIBLLVM = $(shell $(LLVM_CONFIG) --libs) $(shell $(LLVM_CONFIG) --system-libs)
+   LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
+ endif
+ 
+-- 
+2.33.1
+

diff --git a/dev-util/perf/perf-5.15.ebuild b/dev-util/perf/perf-5.15-r1.ebuild
similarity index 96%
rename from dev-util/perf/perf-5.15.ebuild
rename to dev-util/perf/perf-5.15-r1.ebuild
index 3d3079203e9..be6ab29e81f 100644
--- a/dev-util/perf/perf-5.15.ebuild
+++ b/dev-util/perf/perf-5.15-r1.ebuild
@@ -54,8 +54,8 @@ RDEPEND="audit? ( sys-process/audit )
 	babeltrace? ( dev-util/babeltrace )
 	crypt? ( virtual/libcrypt:= )
 	clang? (
-		<sys-devel/clang-10:*
-		<sys-devel/llvm-10:*
+		sys-devel/clang:=
+		sys-devel/llvm:=
 	)
 	gtk? ( x11-libs/gtk+:2 )
 	java? ( virtual/jre:* )
@@ -96,7 +96,7 @@ pkg_pretend() {
 }
 
 pkg_setup() {
-	use clang && LLVM_MAX_SLOT=9 llvm_pkg_setup
+	use clang && llvm_pkg_setup
 	# We enable python unconditionally as libbpf always generates
 	# API headers using python script
 	python_setup
@@ -141,6 +141,12 @@ src_prepare() {
 		popd || die
 	fi
 
+	if use clang; then
+		pushd "${S_K}" >/dev/null || die
+		eapply "${FILESDIR}"/${P}-clang.patch
+		popd || die
+	fi
+
 	# Drop some upstream too-developer-oriented flags and fix the
 	# Makefile in general
 	sed -i \
@@ -222,9 +228,7 @@ perf_make() {
 src_compile() {
 	# test-clang.bin not build with g++
 	if use clang; then
-		pushd "${S_K}/tools/build/feature/" || die
-		make V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-		popd
+		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
 	fi
 	perf_make -f Makefile.perf
 	use doc && perf_make -C Documentation man


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2022-11-17  5:09 Michał Górny
  0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2022-11-17  5:09 UTC (permalink / raw
  To: gentoo-commits

commit:     41355d5ee50bb0cb7af9058f0af753a7cf73d602
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 17 04:59:08 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Nov 17 04:59:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41355d5e

dev-util/perf: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-util/perf/Manifest                      |   4 -
 dev-util/perf/files/perf-5.15-clang.patch   | 231 ------------------------
 dev-util/perf/files/perf-5.17.1-clang.patch |  61 -------
 dev-util/perf/perf-5.15-r1.ebuild           | 266 ----------------------------
 dev-util/perf/perf-5.17.1.ebuild            | 264 ---------------------------
 dev-util/perf/perf-5.18.ebuild              | 264 ---------------------------
 6 files changed, 1090 deletions(-)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index e5f10036beaf..076d2671e177 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -1,7 +1,3 @@
-DIST linux-5.15.tar.xz 121913744 BLAKE2B 3921274b23f7938abdf3ed9334534b4581e13d7484303d3a5280eddb038999aaa8b836666a487472d9c4a219af0f06b9fecccaf348fb5510ab8762f4ef4b7e83 SHA512 d25ad40b5bcd6a4c6042fd0fd84e196e7a58024734c3e9a484fd0d5d54a0c1d87db8a3c784eff55e43b6f021709dc685eb0efa18d2aec327e4f88a79f405705a
-DIST linux-5.17.tar.xz 128399340 BLAKE2B 82dc4a45cc25c781ac67aa6ed1e4c369544154960f41c4634d47621f381159687a227054976d078524cda28884d395a15f7542fe44ca74ce98ca6ff54a81d6d0 SHA512 89f0a7ca69d20a539d4b612a7028a30a5e98b402e4b6b88516f14237e5da4b626d7929eab8b40fccc90766e8f3bae87e9858a19077ffad20d8204acf18794f5b
-DIST linux-5.18.tar.xz 129790264 BLAKE2B e2745a69eb70169e90505a9318a3993046eab3020496eecde7d8352ecda0eb71a25b21becf7ce93fc593507dce7d1cd61b94ddcdf82b3094d79c0d3d48508eeb SHA512 dbbc9d1395898a498fa4947fceda1781344fa5d360240f753810daa4fa88e519833e2186c4e582a8f1836e6413e9e85f6563c7770523b704e8702d67622f98b5
 DIST linux-5.19.tar.xz 131581464 BLAKE2B 4db03a6830a3b3bbf0837e1912182a443d9a4aa8af20a12e6ec814ed708038452d3c0ccee1258cca671c464d76461536363a8adc56e9d098c9a44ae3484a297a SHA512 00313b2f9b82d2dc3fb8294007cf7d7599d254b717ed2de23c81fa7a1bbcbc2798ad286cb94e2f7f5bd54132d1d764facd90d30f79dbcc6616cc7f926adc2623
 DIST linux-6.0.tar.xz 133886176 BLAKE2B c09a9c877ac0fac83dc31d2d04d96f0a3331d4ed78e3ad4edfd4dc077e1c11d0c49f419fdac4008b5c93d1b09c2b724e12ef0b38371ad0962908abf85dfa95fa SHA512 bac41a7aeb6e809616cee2f13dcd1c45e829dfd1ccf60aee1dc4c46b1e28532f4485c7d819a32940de84fdfbf89db80a4e919bce8a74b2948c5a01551771b714
-DIST patch-5.17.1.xz 15244 BLAKE2B f340b8a103754122153dd381fe210b18ba37b7262dae4fc7a1f99c5a62868c9bdb178e83865b35f00b82bd2d67ae127c440515d1740093825f7ec7fa4c4a490d SHA512 fb9a28ce7c68daeca82586e7631dc0be00a1a8393b4cef4c659fc1f9dac6e1f941bd60671c0350d1dea9cb035f56d627f64a394a9acb00b2b5dea8a1d44c065f
 DIST perf-5.19-binutils-2.39-patches.tar.xz 5612 BLAKE2B ec3aeadc3e2508f33dddbb419f434885b39b8220d294f3845f0bc96282923ff46dca126a04c732b8286752e56087ba5b2c5ad9526884f6d0b8b6df5665121e5e SHA512 af676e5a600e227d85f89a5ee0cfacfe1845aa56c27ef9da3ebaf578362d7e741375d30565759123b33b86d36bc9981c8c4cda113af32745cc59cf4a9275e73b

diff --git a/dev-util/perf/files/perf-5.15-clang.patch b/dev-util/perf/files/perf-5.15-clang.patch
deleted file mode 100644
index 5ea0c75f27f1..000000000000
--- a/dev-util/perf/files/perf-5.15-clang.patch
+++ /dev/null
@@ -1,231 +0,0 @@
-From e1f1cbfe812e4a019034105ab5e81fd9f0742353 Mon Sep 17 00:00:00 2001
-From: Ian Rogers <irogers@google.com>
-Date: Mon, 11 Oct 2021 19:13:20 -0700
-Subject: [PATCH 1/3] tools: Bump minimum LLVM C++ std to GNU++14
-
-LLVM 9 (current release is LLVM 13) moved the minimum C++ version to
-GNU++14. Bump the version numbers in the feature test and perf build.
-
-Reviewed-by: Fangrui Song <maskray@google.com>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: Leo Yan <leo.yan@linaro.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Michael Petlan <mpetlan@redhat.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Nathan Chancellor <nathan@kernel.org>
-Cc: Nick Desaulniers <ndesaulniers@google.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: llvm@lists.linux.dev
-Link: https://lore.kernel.org/r/20211012021321.291635-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/feature/Makefile | 6 +++---
- tools/perf/Makefile.config   | 2 +-
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index eff55d287db1..9756e589e4ae 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -296,7 +296,7 @@ $(OUTPUT)test-jvmti-cmlr.bin:
- 	$(BUILD)
- 
- $(OUTPUT)test-llvm.bin:
--	$(BUILDXX) -std=gnu++11 				\
-+	$(BUILDXX) -std=gnu++14 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
- 		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
-@@ -304,12 +304,12 @@ $(OUTPUT)test-llvm.bin:
- 		> $(@:.bin=.make.output) 2>&1
- 
- $(OUTPUT)test-llvm-version.bin:
--	$(BUILDXX) -std=gnu++11 				\
-+	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
- $(OUTPUT)test-clang.bin:
--	$(BUILDXX) -std=gnu++11 				\
-+	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
- 		-Wl,--start-group -lclangBasic -lclangDriver	\
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index 14e3e8d702a0..ddbe86defe39 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -285,7 +285,7 @@ CORE_CFLAGS += -Wall
- CORE_CFLAGS += -Wextra
- CORE_CFLAGS += -std=gnu99
- 
--CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
-+CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
- CXXFLAGS += -Wall
- CXXFLAGS += -fno-omit-frame-pointer
- CXXFLAGS += -ggdb3
--- 
-2.33.1
-
-
-From 3e5c11995e04a9e3351330c34c4c802ce50df46c Mon Sep 17 00:00:00 2001
-From: Ian Rogers <irogers@google.com>
-Date: Mon, 11 Oct 2021 19:13:21 -0700
-Subject: [PATCH 2/3] perf clang: Fixes for more recent LLVM/clang
-
-The parameters to two functions and the location of a variable have
-changed in more recent LLVM/clang releases.
-
-Remove the unneecessary -fmessage-length and -ferror-limit flags, the
-former causes failures like:
-
-  58: builtin clang support                                           :
-  58.1: builtin clang compile C source to IR                          :
-  --- start ---
-  test child forked, pid 279307
-  error: unknown argument: '-fmessage-length'
-  1 error generated.
-  test child finished with -1
-
-Tested with LLVM 6, 8, 9, 10 and 11.
-
-Reviewed-by: Fangrui Song <maskray@google.com>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: Leo Yan <leo.yan@linaro.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Michael Petlan <mpetlan@redhat.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Nathan Chancellor <nathan@kernel.org>
-Cc: Nick Desaulniers <ndesaulniers@google.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>,
-Cc: llvm@lists.linux.dev
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/util/c++/clang.cpp | 21 +++++++++++++--------
- 1 file changed, 13 insertions(+), 8 deletions(-)
-
-diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
-index c8885dfa3667..df7b18fb6b6e 100644
---- a/tools/perf/util/c++/clang.cpp
-+++ b/tools/perf/util/c++/clang.cpp
-@@ -43,8 +43,6 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
- 		"-cc1",
- 		"-triple", "bpf-pc-linux",
- 		"-fsyntax-only",
--		"-ferror-limit", "19",
--		"-fmessage-length", "127",
- 		"-O2",
- 		"-nostdsysteminc",
- 		"-nobuiltininc",
-@@ -55,7 +53,11 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
- 		"-x", "c"};
- 
- 	CCArgs.append(CFlags.begin(), CFlags.end());
--	CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs);
-+	CompilerInvocation *CI = tooling::newInvocation(&Diags, CCArgs
-+#if CLANG_VERSION_MAJOR >= 11
-+                                                        ,/*BinaryName=*/nullptr
-+#endif
-+                                                        );
- 
- 	FrontendOptions& Opts = CI->getFrontendOpts();
- 	Opts.Inputs.clear();
-@@ -151,13 +153,16 @@ getBPFObjectFromModule(llvm::Module *Module)
- 
- 	legacy::PassManager PM;
- 	bool NotAdded;
--#if CLANG_VERSION_MAJOR < 7
--	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
--						      TargetMachine::CGFT_ObjectFile);
-+	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream
-+#if CLANG_VERSION_MAJOR >= 7
-+                                                      , /*DwoOut=*/nullptr
-+#endif
-+#if CLANG_VERSION_MAJOR < 10
-+                                                      , TargetMachine::CGFT_ObjectFile
- #else
--	NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
--						      TargetMachine::CGFT_ObjectFile);
-+                                                      , llvm::CGFT_ObjectFile
- #endif
-+                                                      );
- 	if (NotAdded) {
- 		llvm::errs() << "TargetMachine can't emit a file of this type\n";
- 		return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);
--- 
-2.33.1
-
-
-From aa2b4e5e920cbaadc0fed9b8aa7c4498feee3dd5 Mon Sep 17 00:00:00 2001
-From: Guilherme Amadio <amadio@cern.ch>
-Date: Thu, 29 Apr 2021 13:44:48 +0200
-Subject: [PATCH 3/3] tools feature: update LLVM/Clang detection
-
-Since LLVM/Clang 10, individual libraries have been merged into
-monolithic libraries libLLVM.so, libclang.so, and libclang-cpp.so.
----
- tools/build/feature/Makefile | 8 +++-----
- tools/perf/Makefile.perf     | 7 ++-----
- 2 files changed, 5 insertions(+), 10 deletions(-)
-
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 9756e589e4ae..23478bd06093 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -299,7 +299,7 @@ $(OUTPUT)test-llvm.bin:
- 	$(BUILDXX) -std=gnu++14 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
-+		$(shell $(LLVM_CONFIG) --libs)			\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
-@@ -312,11 +312,9 @@ $(OUTPUT)test-clang.bin:
- 	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		-Wl,--start-group -lclangBasic -lclangDriver	\
--		  -lclangFrontend -lclangEdit -lclangLex	\
--		  -lclangAST -Wl,--end-group 			\
--		$(shell $(LLVM_CONFIG) --libs Core option)	\
-+		$(shell $(LLVM_CONFIG) --libs)			\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
-+		-lclang-cpp					\
- 		> $(@:.bin=.make.output) 2>&1
- 
- -include $(OUTPUT)*.d
-diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
-index b856afa6eb52..d0ff0ddf9c18 100644
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -410,14 +410,11 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
- LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
- 
- ifeq ($(USE_CLANG), 1)
--  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
--  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
--  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
--  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
-+  LIBS += -lclang-cpp
- endif
- 
- ifeq ($(USE_LLVM), 1)
--  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
-+  LIBLLVM = $(shell $(LLVM_CONFIG) --libs) $(shell $(LLVM_CONFIG) --system-libs)
-   LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
- endif
- 
--- 
-2.33.1
-

diff --git a/dev-util/perf/files/perf-5.17.1-clang.patch b/dev-util/perf/files/perf-5.17.1-clang.patch
deleted file mode 100644
index 73d4506146c0..000000000000
--- a/dev-util/perf/files/perf-5.17.1-clang.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-
-Fix building against LLVM/Clang with monolithic libraries and
-adjust header includes for Clang >= 14.
-
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -299,7 +299,7 @@ $(OUTPUT)test-llvm.bin:
- 	$(BUILDXX) -std=gnu++14 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
-+		$(shell $(LLVM_CONFIG) --libs)			\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
-@@ -312,10 +312,7 @@ $(OUTPUT)test-clang.bin:
- 	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		-Wl,--start-group -lclangBasic -lclangDriver	\
--		  -lclangFrontend -lclangEdit -lclangLex	\
--		  -lclangAST -Wl,--end-group 			\
--		$(shell $(LLVM_CONFIG) --libs Core option)	\
-+		-lclang-cpp $(shell $(LLVM_CONFIG) --libs)	\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -417,14 +417,11 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
- LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
- 
- ifeq ($(USE_CLANG), 1)
--  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
--  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
--  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
--  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
-+  LIBS += -lclang-cpp
- endif
- 
- ifeq ($(USE_LLVM), 1)
--  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
-+  LIBLLVM = $(shell $(LLVM_CONFIG) --libs) $(shell $(LLVM_CONFIG) --system-libs)
-   LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
- endif
- 
---- a/tools/perf/util/c++/clang.cpp
-+++ b/tools/perf/util/c++/clang.cpp
-@@ -20,7 +20,11 @@
- #include "llvm/Option/Option.h"
- #include "llvm/Support/FileSystem.h"
- #include "llvm/Support/ManagedStatic.h"
-+#if CLANG_VERSION_MAJOR >= 14
-+#include "llvm/MC/TargetRegistry.h"
-+#else
- #include "llvm/Support/TargetRegistry.h"
-+#endif
- #include "llvm/Support/TargetSelect.h"
- #include "llvm/Target/TargetMachine.h"
- #include "llvm/Target/TargetOptions.h"
-

diff --git a/dev-util/perf/perf-5.15-r1.ebuild b/dev-util/perf/perf-5.15-r1.ebuild
deleted file mode 100644
index 9f1e52387618..000000000000
--- a/dev-util/perf/perf-5.15-r1.ebuild
+++ /dev/null
@@ -1,266 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..10} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 ~riscv x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-	${PYTHON_DEPS}
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		<sys-devel/clang-14:=
-		<sys-devel/llvm-14:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	usr/bin/perf-read-vdso32 # not linked with anything except for libc
-	usr/libexec/perf-core/dlfilters/dlfilter-test-api-v0.so # not installed
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && LLVM_MAX_SLOT=13 llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	if use clang; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${FILESDIR}"/${P}-clang.patch
-		popd || die
-	fi
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}

diff --git a/dev-util/perf/perf-5.17.1.ebuild b/dev-util/perf/perf-5.17.1.ebuild
deleted file mode 100644
index 773d205044fc..000000000000
--- a/dev-util/perf/perf-5.17.1.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8..10} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-	${PYTHON_DEPS}
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/${P}-clang.patch
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}

diff --git a/dev-util/perf/perf-5.18.ebuild b/dev-util/perf/perf-5.18.ebuild
deleted file mode 100644
index 773d205044fc..000000000000
--- a/dev-util/perf/perf-5.18.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8..10} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-	${PYTHON_DEPS}
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/${P}-clang.patch
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2023-04-15  5:13 Sam James
  0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-04-15  5:13 UTC (permalink / raw
  To: gentoo-commits

commit:     d1a3661d06ab2036402024ea792bad26b7eb2cda
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 15 05:11:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 15 05:11:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1a3661d

dev-util/perf: fix build w/ clang 16

Closes: https://bugs.gentoo.org/904169
Thanks-to: Maciej S. Szmigiero <mail <AT> maciej.szmigiero.name>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/perf/files/perf-6.0-c++17.patch | 39 ++++++++++++++++++++++++++++++++
 dev-util/perf/perf-6.0-r1.ebuild         |  1 +
 dev-util/perf/perf-6.2-r1.ebuild         |  1 +
 3 files changed, 41 insertions(+)

diff --git a/dev-util/perf/files/perf-6.0-c++17.patch b/dev-util/perf/files/perf-6.0-c++17.patch
new file mode 100644
index 000000000000..08c34bc552ca
--- /dev/null
+++ b/dev-util/perf/files/perf-6.0-c++17.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/904169
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -309,7 +309,7 @@
+ CORE_CFLAGS += -Wextra
+ CORE_CFLAGS += -std=gnu11
+ 
+-CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
++CXXFLAGS += -std=gnu++17 -fno-exceptions -fno-rtti
+ CXXFLAGS += -Wall
+ CXXFLAGS += -fno-omit-frame-pointer
+ CXXFLAGS += -ggdb3
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -339,7 +339,7 @@
+ 	$(BUILD)
+ 
+ $(OUTPUT)test-llvm.bin:
+-	$(BUILDXX) -std=gnu++14 				\
++	$(BUILDXX) -std=gnu++17 				\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+ 		$(shell $(LLVM_CONFIG) --libs)			\
+@@ -347,12 +347,12 @@
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+ $(OUTPUT)test-llvm-version.bin:
+-	$(BUILDXX) -std=gnu++14					\
++	$(BUILDXX) -std=gnu++17					\
+ 		-I$(shell $(LLVM_CONFIG) --includedir)		\
+ 		> $(@:.bin=.make.output) 2>&1
+ 
+ $(OUTPUT)test-clang.bin:
+-	$(BUILDXX) -std=gnu++14					\
++	$(BUILDXX) -std=gnu++17					\
+ 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+ 		-L$(shell $(LLVM_CONFIG) --libdir)		\
+ 		-lclang-cpp $(shell $(LLVM_CONFIG) --libs)	\
+

diff --git a/dev-util/perf/perf-6.0-r1.ebuild b/dev-util/perf/perf-6.0-r1.ebuild
index be9dbc82a5f9..04184b462006 100644
--- a/dev-util/perf/perf-6.0-r1.ebuild
+++ b/dev-util/perf/perf-6.0-r1.ebuild
@@ -145,6 +145,7 @@ src_prepare() {
 
 	pushd "${S_K}" >/dev/null || die
 	eapply "${FILESDIR}"/${P}-clang.patch
+	eapply "${FILESDIR}"/perf-6.0-c++17.patch
 	popd || die
 
 	# Drop some upstream too-developer-oriented flags and fix the

diff --git a/dev-util/perf/perf-6.2-r1.ebuild b/dev-util/perf/perf-6.2-r1.ebuild
index 8dc6385d598e..8a46cf67337d 100644
--- a/dev-util/perf/perf-6.2-r1.ebuild
+++ b/dev-util/perf/perf-6.2-r1.ebuild
@@ -145,6 +145,7 @@ src_prepare() {
 
 	pushd "${S_K}" >/dev/null || die
 	eapply "${FILESDIR}"/perf-6.0-clang.patch
+	eapply "${FILESDIR}"/perf-6.0-c++17.patch
 	popd || die
 
 	# Drop some upstream too-developer-oriented flags and fix the


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2023-07-06  7:44 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2023-07-06  7:44 UTC (permalink / raw
  To: gentoo-commits

commit:     529bc1649627b30bad63527bedb0cf272db67b81
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  5 13:07:20 2023 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Thu Jul  6 07:38:55 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=529bc164

dev-util/perf: version bump to 6.4

Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/Manifest                        |   1 +
 dev-util/perf/files/perf-6.4-libtracefs.patch |  23 ++
 dev-util/perf/metadata.xml                    |   3 +
 dev-util/perf/perf-6.4.ebuild                 | 308 ++++++++++++++++++++++++++
 4 files changed, 335 insertions(+)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index 46a7ae78c623..32507222d0a3 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -2,4 +2,5 @@ DIST linux-5.19.tar.xz 131581464 BLAKE2B 4db03a6830a3b3bbf0837e1912182a443d9a4aa
 DIST linux-6.0.tar.xz 133886176 BLAKE2B c09a9c877ac0fac83dc31d2d04d96f0a3331d4ed78e3ad4edfd4dc077e1c11d0c49f419fdac4008b5c93d1b09c2b724e12ef0b38371ad0962908abf85dfa95fa SHA512 bac41a7aeb6e809616cee2f13dcd1c45e829dfd1ccf60aee1dc4c46b1e28532f4485c7d819a32940de84fdfbf89db80a4e919bce8a74b2948c5a01551771b714
 DIST linux-6.2.tar.xz 136430892 BLAKE2B 05b63254734ea685db437cb1c00a6da63eee74d7e99f4ed2d074aaa01ac4487813ab297d337a6855cdbcbb33346b631c4256ee3b06191adfb1be3615a56bdd6d SHA512 a01bee0b968b95183934fe3504516be7ef5811944a061f5aed05ecebaa27b5eb64e33232fd0a8dd622b3c8743bfe462ef7e464d381734d111a0ad6a6d9f66ddd
 DIST linux-6.3.tar.xz 136891752 BLAKE2B f1887c8924efa8d0cb14c4e604affd0b0168bcf20f56a37c027405c7bc11aba822a43fcb38ccb55a81a26f747d00e1ab5a6554818affbf1e1c7ef5220150fc69 SHA512 768979440f4907ba64d4481b383d6101faf208f27a0b897156123aa278c5743fe3c4f61945b2541429c532d45382aaee8899ea9d44a1d2895bfbb79bfd937f65
+DIST linux-6.4.tar.xz 137794856 BLAKE2B b59eb04a8715af9f686978812e6d4a466172bb859f80657076de14cd0828b4fac15b688ff8959f5c65485f7f6bef26590412c66821e720de843cb8666f226c90 SHA512 11a48b25e0b513782d3b89101c2ec8dd9cefd6ce08dc63a91137903b66392aa72ca1fe32816710673af84dd47de3ab8738056a6af93dc0d5e60ef4b869b49928
 DIST perf-5.19-binutils-2.39-patches.tar.xz 5612 BLAKE2B ec3aeadc3e2508f33dddbb419f434885b39b8220d294f3845f0bc96282923ff46dca126a04c732b8286752e56087ba5b2c5ad9526884f6d0b8b6df5665121e5e SHA512 af676e5a600e227d85f89a5ee0cfacfe1845aa56c27ef9da3ebaf578362d7e741375d30565759123b33b86d36bc9981c8c4cda113af32745cc59cf4a9275e73b

diff --git a/dev-util/perf/files/perf-6.4-libtracefs.patch b/dev-util/perf/files/perf-6.4-libtracefs.patch
new file mode 100644
index 000000000000..e02e2db96677
--- /dev/null
+++ b/dev-util/perf/files/perf-6.4-libtracefs.patch
@@ -0,0 +1,23 @@
+Let perf find libtraceevent headers when detecting libtracefs
+
+--- a/tools/build/feature/test-libtracefs.c
++++ b/tools/build/feature/test-libtracefs.c
+@@ -1,5 +1,5 @@
+ // SPDX-License-Identifier: GPL-2.0
+-#include <tracefs/tracefs.h>
++#include <tracefs.h>
+ 
+ int main(void)
+ {
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -185,6 +185,9 @@ endif
+ FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
+ FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
+ 
++FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs)
++FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs)
++
+ ifdef LIBZSTD_DIR
+   LIBZSTD_CFLAGS  := -I$(LIBZSTD_DIR)/lib
+   LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib

diff --git a/dev-util/perf/metadata.xml b/dev-util/perf/metadata.xml
index a363827ff153..44f52d4869a8 100644
--- a/dev-util/perf/metadata.xml
+++ b/dev-util/perf/metadata.xml
@@ -14,6 +14,7 @@
     <name>Guilherme Amadio</name>
   </maintainer>
   <use>
+    <flag name="bpf">Enable support for eBPF features with <pkg>dev-libs/libbpf</pkg></flag>
     <flag name="babeltrace">Enable <pkg>dev-util/babeltrace</pkg> support</flag>
     <flag name="clang">Enable builtin clang and LLVM support</flag>
     <flag name="doc">
@@ -24,6 +25,8 @@
       systems.
     </flag>
     <flag name="libpfm">Enable <pkg>dev-libs/libpfm</pkg> support</flag>
+    <flag name="libtraceevent">Enable <pkg>dev-libs/libtraceevent</pkg> support</flag>
+    <flag name="libtracefs">Enable <pkg>dev-libs/libtracefs</pkg> support</flag>
     <flag name="numa">Enable NUMA support</flag>
     <flag name="perl">
       Add support for Perl as a scripting language for perf tools.

diff --git a/dev-util/perf/perf-6.4.ebuild b/dev-util/perf/perf-6.4.ebuild
new file mode 100644
index 000000000000..2ef01e9f9d7b
--- /dev/null
+++ b/dev-util/perf/perf-6.4.ebuild
@@ -0,0 +1,308 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit bash-completion-r1 estack linux-info llvm toolchain-funcs python-r1
+
+DESCRIPTION="Userland tools for Linux Performance Counters"
+HOMEPAGE="https://perf.wiki.kernel.org/"
+
+LINUX_V="${PV:0:1}.x"
+if [[ ${PV} == *_rc* ]] ; then
+	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
+	PATCH_VERSION=$(ver_cut 1-3)
+	LINUX_PATCH=patch-${PV//_/-}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
+		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
+elif [[ ${PV} == *.*.* ]] ; then
+	# stable-release series
+	LINUX_VER=$(ver_cut 1-2)
+	LINUX_PATCH=patch-${PV}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
+else
+	LINUX_VER=${PV}
+	SRC_URI=""
+fi
+
+LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
+SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+IUSE="audit babeltrace bpf caps clang crypt debug +doc gtk java libpfm libtraceevent libtracefs lzma numa perl python slang systemtap tcmalloc unwind zstd"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+# setuptools (and Python) are always needed even if not building Python bindings
+BDEPEND="
+	${LINUX_PATCH+dev-util/patchutils}
+	${PYTHON_DEPS}
+	>=app-arch/tar-1.34-r2
+	dev-python/setuptools[${PYTHON_USEDEP}]
+	sys-devel/bison
+	sys-devel/flex
+	virtual/pkgconfig
+	doc? (
+		app-text/asciidoc
+		app-text/sgml-common
+		app-text/xmlto
+		sys-process/time
+	)
+"
+
+RDEPEND="
+	audit? ( sys-process/audit )
+	babeltrace? ( dev-util/babeltrace )
+	bpf? (
+		dev-libs/libbpf
+		dev-util/bpftool
+		dev-util/pahole
+	)
+	caps? ( sys-libs/libcap )
+	clang? (
+		sys-devel/clang:=
+		sys-devel/llvm:=
+	)
+	crypt? ( dev-libs/openssl:= )
+	gtk? ( x11-libs/gtk+:2 )
+	java? ( virtual/jre:* )
+	libpfm? ( dev-libs/libpfm:= )
+	libtraceevent? ( dev-libs/libtraceevent )
+	libtracefs? ( dev-libs/libtracefs )
+	lzma? ( app-arch/xz-utils )
+	numa? ( sys-process/numactl )
+	perl? ( dev-lang/perl:= )
+	python? ( ${PYTHON_DEPS} )
+	slang? ( sys-libs/slang )
+	systemtap? ( dev-util/systemtap )
+	tcmalloc? ( dev-util/google-perftools )
+	unwind? ( sys-libs/libunwind:= )
+	zstd? ( app-arch/zstd:= )
+	dev-libs/elfutils
+	sys-libs/binutils-libs:=
+	sys-libs/zlib
+"
+
+DEPEND="${RDEPEND}
+	>=sys-kernel/linux-headers-5.10
+	java? ( virtual/jdk )
+"
+
+S_K="${WORKDIR}/linux-${LINUX_VER}"
+S="${S_K}/tools/perf"
+
+CONFIG_CHECK="
+	~DEBUG_INFO
+	~FTRACE
+	~FTRACE_SYSCALLS
+	~FUNCTION_TRACER
+	~KALLSYMS
+	~KALLSYMS_ALL
+	~KPROBES
+	~KPROBE_EVENTS
+	~PERF_EVENTS
+	~UPROBES
+	~UPROBE_EVENTS
+"
+
+QA_FLAGS_IGNORED=(
+	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
+	'usr/libexec/perf-core/dlfilters/.*' # plugins
+)
+
+pkg_pretend() {
+	if ! use doc ; then
+		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
+		ewarn "And without man pages, you won't get any --help output for perf and its"
+		ewarn "sub-tools."
+	fi
+}
+
+pkg_setup() {
+	use clang && llvm_pkg_setup
+	# We enable python unconditionally as libbpf always generates
+	# API headers using python script
+	python_setup
+
+	if use bpf ; then
+		CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT"
+	fi
+
+	linux-info_pkg_setup
+}
+
+# src_unpack and src_prepare are copied to dev-util/bpftool since
+# it's building from the same tarball, please keep it in sync with bpftool
+src_unpack() {
+	local paths=(
+		kernel/bpf tools/{arch,bpf,build,include,lib,perf,scripts}
+		scripts include lib "arch/*/lib"
+	)
+
+	# We expect the tar implementation to support the -j option (both
+	# GNU tar and libarchive's tar support that).
+	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
+	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
+		"${paths[@]/#/linux-${LINUX_VER}/}" || die
+
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		eshopts_push -o noglob
+		ebegin "Filtering partial source patch"
+		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
+			> ${P}.patch
+		eend $? || die "filterdiff failed"
+		eshopts_pop
+	fi
+
+	local a
+	for a in ${A}; do
+		[[ ${a} == ${LINUX_SOURCES} ]] && continue
+		[[ ${a} == ${LINUX_PATCH} ]] && continue
+		unpack ${a}
+	done
+}
+
+src_prepare() {
+	default
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		pushd "${S_K}" >/dev/null || die
+		eapply "${WORKDIR}"/${P}.patch
+		popd || die
+	fi
+
+	pushd "${S_K}" >/dev/null || die
+	eapply "${FILESDIR}"/perf-6.0-clang.patch
+	eapply "${FILESDIR}"/perf-6.0-c++17.patch
+	eapply "${FILESDIR}"/perf-6.4-libtracefs.patch
+	popd || die
+
+	# Drop some upstream too-developer-oriented flags and fix the
+	# Makefile in general
+	sed -i \
+		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
+		"${S}"/Makefile.perf || die
+	# A few places still use -Werror w/out $(WERROR) protection.
+	sed -i -e 's@-Werror@@' \
+		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile \
+		"${S_K}"/tools/lib/perf/Makefile || die
+
+	# Avoid the call to make kernelversion
+	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
+	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
+
+	# The code likes to compile local assembly files which lack ELF markings.
+	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
+}
+
+puse() { usex $1 "" no; }
+perf_make() {
+	# The arch parsing is a bit funky.  The perf tools package is integrated
+	# into the kernel, so it wants an ARCH that looks like the kernel arch,
+	# but it also wants to know about the split value -- i386/x86_64 vs just
+	# x86.  We can get that by telling the func to use an older linux version.
+	# It's kind of a hack, but not that bad ...
+
+	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
+
+	local arch=$(tc-arch-kernel)
+	local java_dir
+	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
+	# FIXME: NO_CORESIGHT
+	local emakeargs=(
+		V=1 VF=1
+		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)"
+		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)"
+		PKG_CONFIG="$(tc-getPKG_CONFIG)"
+		prefix="${EPREFIX}/usr" bindir_relative="bin"
+		tipdir="share/doc/${PF}"
+		EXTRA_CFLAGS="${CFLAGS}"
+		EXTRA_LDFLAGS="${LDFLAGS}"
+		ARCH="${arch}"
+		BUILD_BPF_SKEL=$(usex bpf 1 "") \
+		BUILD_NONDISTRO=1
+		JDIR="${java_dir}"
+		LIBCLANGLLVM=$(usex clang 1 "")
+		LIBPFM4=$(usex libpfm 1 "")
+		NO_AUXTRACE=""
+		NO_BACKTRACE=""
+		CORESIGHT=
+		NO_DEMANGLE=
+		GTK2=$(usex gtk 1 "")
+		feature-gtk2-infobar=$(usex gtk 1 "")
+		NO_JEVENTS=$(puse python)
+		NO_JVMTI=$(puse java)
+		NO_LIBAUDIT=$(puse audit)
+		NO_LIBBABELTRACE=$(puse babeltrace)
+		NO_LIBBIONIC=1
+		NO_LIBBPF=$(puse bpf)
+		NO_LIBCAP=$(puse caps)
+		NO_LIBCRYPTO=$(puse crypt)
+		NO_LIBDW_DWARF_UNWIND=
+		NO_LIBELF=
+		NO_LIBNUMA=$(puse numa)
+		NO_LIBPERL=$(puse perl)
+		NO_LIBPYTHON=$(puse python)
+		NO_LIBTRACEEVENT=$(puse libtraceevent)
+		NO_LIBUNWIND=$(puse unwind)
+		NO_LIBZSTD=$(puse zstd)
+		NO_SDT=$(puse systemtap)
+		NO_SLANG=$(puse slang)
+		NO_LZMA=$(puse lzma)
+		NO_ZLIB=
+		TCMALLOC=$(usex tcmalloc)
+		WERROR=0
+		LIBDIR="/usr/libexec/perf-core"
+		libdir="${EPREFIX}/usr/$(get_libdir)"
+		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins"
+		"$@"
+	)
+	emake "${emakeargs[@]}"
+}
+
+src_compile() {
+	# test-clang.bin not build with g++
+	if use clang; then
+		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
+	fi
+	perf_make -f Makefile.perf
+	use doc && perf_make -C Documentation man
+}
+
+src_test() {
+	:
+}
+
+src_install() {
+	_install_python_ext() {
+		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
+	}
+
+	perf_make -f Makefile.perf install DESTDIR="${D}"
+
+	if use python; then
+		python_foreach_impl _install_python_ext
+	fi
+
+	if use gtk; then
+		local libdir
+		libdir="$(get_libdir)"
+		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
+		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
+		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
+			"${ED}"/usr/libexec/perf-core || die
+	fi
+
+	dodoc CREDITS
+
+	dodoc *txt Documentation/*.txt
+
+	# perf needs this decompressed to print out tips for users
+	docompress -x /usr/share/doc/${PF}/tips.txt
+
+	if use doc ; then
+		doman Documentation/*.1
+	fi
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2023-07-06 16:12 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2023-07-06 16:12 UTC (permalink / raw
  To: gentoo-commits

commit:     443b60a7c73a5637dad6a47a50b5351163572818
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  6 15:51:37 2023 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Thu Jul  6 16:11:40 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=443b60a7

dev-util/perf: drop 5.19-r1, 6.0-r1, 6.2-r1

Closes: https://bugs.gentoo.org/832704
Closes: https://bugs.gentoo.org/855539

Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/Manifest                    |   4 -
 dev-util/perf/files/perf-5.18-clang.patch |  45 -----
 dev-util/perf/perf-5.19-r1.ebuild         | 274 ------------------------------
 dev-util/perf/perf-6.0-r1.ebuild          | 269 -----------------------------
 dev-util/perf/perf-6.2-r1.ebuild          | 269 -----------------------------
 5 files changed, 861 deletions(-)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index 32507222d0a3..a8c77095f0ca 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -1,6 +1,2 @@
-DIST linux-5.19.tar.xz 131581464 BLAKE2B 4db03a6830a3b3bbf0837e1912182a443d9a4aa8af20a12e6ec814ed708038452d3c0ccee1258cca671c464d76461536363a8adc56e9d098c9a44ae3484a297a SHA512 00313b2f9b82d2dc3fb8294007cf7d7599d254b717ed2de23c81fa7a1bbcbc2798ad286cb94e2f7f5bd54132d1d764facd90d30f79dbcc6616cc7f926adc2623
-DIST linux-6.0.tar.xz 133886176 BLAKE2B c09a9c877ac0fac83dc31d2d04d96f0a3331d4ed78e3ad4edfd4dc077e1c11d0c49f419fdac4008b5c93d1b09c2b724e12ef0b38371ad0962908abf85dfa95fa SHA512 bac41a7aeb6e809616cee2f13dcd1c45e829dfd1ccf60aee1dc4c46b1e28532f4485c7d819a32940de84fdfbf89db80a4e919bce8a74b2948c5a01551771b714
-DIST linux-6.2.tar.xz 136430892 BLAKE2B 05b63254734ea685db437cb1c00a6da63eee74d7e99f4ed2d074aaa01ac4487813ab297d337a6855cdbcbb33346b631c4256ee3b06191adfb1be3615a56bdd6d SHA512 a01bee0b968b95183934fe3504516be7ef5811944a061f5aed05ecebaa27b5eb64e33232fd0a8dd622b3c8743bfe462ef7e464d381734d111a0ad6a6d9f66ddd
 DIST linux-6.3.tar.xz 136891752 BLAKE2B f1887c8924efa8d0cb14c4e604affd0b0168bcf20f56a37c027405c7bc11aba822a43fcb38ccb55a81a26f747d00e1ab5a6554818affbf1e1c7ef5220150fc69 SHA512 768979440f4907ba64d4481b383d6101faf208f27a0b897156123aa278c5743fe3c4f61945b2541429c532d45382aaee8899ea9d44a1d2895bfbb79bfd937f65
 DIST linux-6.4.tar.xz 137794856 BLAKE2B b59eb04a8715af9f686978812e6d4a466172bb859f80657076de14cd0828b4fac15b688ff8959f5c65485f7f6bef26590412c66821e720de843cb8666f226c90 SHA512 11a48b25e0b513782d3b89101c2ec8dd9cefd6ce08dc63a91137903b66392aa72ca1fe32816710673af84dd47de3ab8738056a6af93dc0d5e60ef4b869b49928
-DIST perf-5.19-binutils-2.39-patches.tar.xz 5612 BLAKE2B ec3aeadc3e2508f33dddbb419f434885b39b8220d294f3845f0bc96282923ff46dca126a04c732b8286752e56087ba5b2c5ad9526884f6d0b8b6df5665121e5e SHA512 af676e5a600e227d85f89a5ee0cfacfe1845aa56c27ef9da3ebaf578362d7e741375d30565759123b33b86d36bc9981c8c4cda113af32745cc59cf4a9275e73b

diff --git a/dev-util/perf/files/perf-5.18-clang.patch b/dev-util/perf/files/perf-5.18-clang.patch
deleted file mode 100644
index d1c9a48e6848..000000000000
--- a/dev-util/perf/files/perf-5.18-clang.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-
-Fix building against LLVM/Clang with monolithic libraries.
-
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -299,7 +299,7 @@ $(OUTPUT)test-llvm.bin:
- 	$(BUILDXX) -std=gnu++14 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
-+		$(shell $(LLVM_CONFIG) --libs)			\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
-@@ -312,10 +312,7 @@ $(OUTPUT)test-clang.bin:
- 	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		-Wl,--start-group -lclangBasic -lclangDriver	\
--		  -lclangFrontend -lclangEdit -lclangLex	\
--		  -lclangAST -Wl,--end-group 			\
--		$(shell $(LLVM_CONFIG) --libs Core option)	\
-+		-lclang-cpp $(shell $(LLVM_CONFIG) --libs)	\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -417,14 +417,11 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
- LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
- 
- ifeq ($(USE_CLANG), 1)
--  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
--  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
--  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
--  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
-+  LIBS += -lclang-cpp
- endif
- 
- ifeq ($(USE_LLVM), 1)
--  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
-+  LIBLLVM = $(shell $(LLVM_CONFIG) --libs) $(shell $(LLVM_CONFIG) --system-libs)
-   LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
- endif
- 

diff --git a/dev-util/perf/perf-5.19-r1.ebuild b/dev-util/perf/perf-5.19-r1.ebuild
deleted file mode 100644
index da0f5c7509fe..000000000000
--- a/dev-util/perf/perf-5.19-r1.ebuild
+++ /dev/null
@@ -1,274 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{9..11} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-	SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-binutils-2.39-patches.tar.xz"
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 ~riscv x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-# setuptools (and Python) are always needed even if not building Python bindings
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	${PYTHON_DEPS}
-	>=app-arch/tar-1.34-r2
-	dev-python/setuptools[${PYTHON_USEDEP}]
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/${PN}-5.18-clang.patch
-	# Used `git format-patch 00b32625982e0c796f0abb8effcac9c05ef55bd3...600b7b26c07a070d0153daa76b3806c1e52c9e00`
-	# bug #868129
-	rm "${WORKDIR}"/${P}-binutils-2.39-patches/0005-tools-bpf_jit_disasm-Fix-compilation-error-with-new-.patch || die
-	rm "${WORKDIR}"/${P}-binutils-2.39-patches/0006-tools-bpf_jit_disasm-Don-t-display-disassembler-four.patch || die
-	rm "${WORKDIR}"/${P}-binutils-2.39-patches/0007-tools-bpftool-Fix-compilation-error-with-new-binutil.patch || die
-	eapply "${WORKDIR}"/${P}-binutils-2.39-patches
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}

diff --git a/dev-util/perf/perf-6.0-r1.ebuild b/dev-util/perf/perf-6.0-r1.ebuild
deleted file mode 100644
index c1abe01f17eb..000000000000
--- a/dev-util/perf/perf-6.0-r1.ebuild
+++ /dev/null
@@ -1,269 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{9..11} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-# setuptools (and Python) are always needed even if not building Python bindings
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	${PYTHON_DEPS}
-	>=app-arch/tar-1.34-r2
-	dev-python/setuptools[${PYTHON_USEDEP}]
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/${P}-clang.patch
-	eapply "${FILESDIR}"/perf-6.0-c++17.patch
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile \
-		"${S_K}"/tools/lib/perf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}

diff --git a/dev-util/perf/perf-6.2-r1.ebuild b/dev-util/perf/perf-6.2-r1.ebuild
deleted file mode 100644
index 8c07d2f59dcb..000000000000
--- a/dev-util/perf/perf-6.2-r1.ebuild
+++ /dev/null
@@ -1,269 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{9..11} )
-inherit bash-completion-r1 estack llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-	SRC_URI=""
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-# setuptools (and Python) are always needed even if not building Python bindings
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	${PYTHON_DEPS}
-	>=app-arch/tar-1.34-r2
-	dev-python/setuptools[${PYTHON_USEDEP}]
-	sys-devel/bison
-	sys-devel/flex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-util/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/perf-6.0-clang.patch
-	eapply "${FILESDIR}"/perf-6.0-c++17.patch
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile \
-		"${S_K}"/tools/lib/perf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND= \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2024-08-06 10:16 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-08-06 10:16 UTC (permalink / raw
  To: gentoo-commits

commit:     1955737ff79a1ad896706c45beca7a5572644dcc
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  6 10:12:08 2024 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Tue Aug  6 10:15:44 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1955737f

dev-util/perf-6.10: fix build with USE=capstone

Upstream patch is in perf-tools-next, rebased it on 6.10.

Bug: https://bugs.gentoo.org/936439

Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/files/perf-6.10-bpf-capstone.patch | 456 +++++++++++++++++++++++
 dev-util/perf/perf-6.10.ebuild                   |   1 +
 2 files changed, 457 insertions(+)

diff --git a/dev-util/perf/files/perf-6.10-bpf-capstone.patch b/dev-util/perf/files/perf-6.10-bpf-capstone.patch
new file mode 100644
index 000000000000..ebae9a3ad080
--- /dev/null
+++ b/dev-util/perf/files/perf-6.10-bpf-capstone.patch
@@ -0,0 +1,456 @@
+From a7728af2f25fe99ee72d211bb4ddec17a8601f5f Mon Sep 17 00:00:00 2001
+From: Guilherme Amadio <amadio@gentoo.org>
+Date: Tue, 6 Aug 2024 11:34:05 +0200
+Subject: [PATCH]  Fix bug #936439. Replay of upstream commit onto v6.10.
+
+Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
+---
+ tools/perf/util/Build        |   1 +
+ tools/perf/util/disasm.c     | 187 +--------------------------------
+ tools/perf/util/disasm_bpf.c | 197 +++++++++++++++++++++++++++++++++++
+ tools/perf/util/disasm_bpf.h |  12 +++
+ 4 files changed, 211 insertions(+), 186 deletions(-)
+ create mode 100644 tools/perf/util/disasm_bpf.c
+ create mode 100644 tools/perf/util/disasm_bpf.h
+
+diff --git a/tools/perf/util/Build b/tools/perf/util/Build
+index da64efd8718f..384c4e06b838 100644
+--- a/tools/perf/util/Build
++++ b/tools/perf/util/Build
+@@ -13,6 +13,7 @@ perf-y += copyfile.o
+ perf-y += ctype.o
+ perf-y += db-export.o
+ perf-y += disasm.o
++perf-y += disasm_bpf.o
+ perf-y += env.o
+ perf-y += event.o
+ perf-y += evlist.o
+diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
+index 72aec8f61b94..766cbd005f32 100644
+--- a/tools/perf/util/disasm.c
++++ b/tools/perf/util/disasm.c
+@@ -15,6 +15,7 @@
+ #include "build-id.h"
+ #include "debug.h"
+ #include "disasm.h"
++#include "disasm_bpf.h"
+ #include "dso.h"
+ #include "env.h"
+ #include "evsel.h"
+@@ -1164,192 +1165,6 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
+ 	return 0;
+ }
+ 
+-#if defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
+-#define PACKAGE "perf"
+-#include <bfd.h>
+-#include <dis-asm.h>
+-#include <bpf/bpf.h>
+-#include <bpf/btf.h>
+-#include <bpf/libbpf.h>
+-#include <linux/btf.h>
+-#include <tools/dis-asm-compat.h>
+-
+-#include "bpf-event.h"
+-#include "bpf-utils.h"
+-
+-static int symbol__disassemble_bpf(struct symbol *sym,
+-				   struct annotate_args *args)
+-{
+-	struct annotation *notes = symbol__annotation(sym);
+-	struct bpf_prog_linfo *prog_linfo = NULL;
+-	struct bpf_prog_info_node *info_node;
+-	int len = sym->end - sym->start;
+-	disassembler_ftype disassemble;
+-	struct map *map = args->ms.map;
+-	struct perf_bpil *info_linear;
+-	struct disassemble_info info;
+-	struct dso *dso = map__dso(map);
+-	int pc = 0, count, sub_id;
+-	struct btf *btf = NULL;
+-	char tpath[PATH_MAX];
+-	size_t buf_size;
+-	int nr_skip = 0;
+-	char *buf;
+-	bfd *bfdf;
+-	int ret;
+-	FILE *s;
+-
+-	if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO)
+-		return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE;
+-
+-	pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__,
+-		  sym->name, sym->start, sym->end - sym->start);
+-
+-	memset(tpath, 0, sizeof(tpath));
+-	perf_exe(tpath, sizeof(tpath));
+-
+-	bfdf = bfd_openr(tpath, NULL);
+-	if (bfdf == NULL)
+-		abort();
+-
+-	if (!bfd_check_format(bfdf, bfd_object))
+-		abort();
+-
+-	s = open_memstream(&buf, &buf_size);
+-	if (!s) {
+-		ret = errno;
+-		goto out;
+-	}
+-	init_disassemble_info_compat(&info, s,
+-				     (fprintf_ftype) fprintf,
+-				     fprintf_styled);
+-	info.arch = bfd_get_arch(bfdf);
+-	info.mach = bfd_get_mach(bfdf);
+-
+-	info_node = perf_env__find_bpf_prog_info(dso->bpf_prog.env,
+-						 dso->bpf_prog.id);
+-	if (!info_node) {
+-		ret = SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF;
+-		goto out;
+-	}
+-	info_linear = info_node->info_linear;
+-	sub_id = dso->bpf_prog.sub_id;
+-
+-	info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns);
+-	info.buffer_length = info_linear->info.jited_prog_len;
+-
+-	if (info_linear->info.nr_line_info)
+-		prog_linfo = bpf_prog_linfo__new(&info_linear->info);
+-
+-	if (info_linear->info.btf_id) {
+-		struct btf_node *node;
+-
+-		node = perf_env__find_btf(dso->bpf_prog.env,
+-					  info_linear->info.btf_id);
+-		if (node)
+-			btf = btf__new((__u8 *)(node->data),
+-				       node->data_size);
+-	}
+-
+-	disassemble_init_for_target(&info);
+-
+-#ifdef DISASM_FOUR_ARGS_SIGNATURE
+-	disassemble = disassembler(info.arch,
+-				   bfd_big_endian(bfdf),
+-				   info.mach,
+-				   bfdf);
+-#else
+-	disassemble = disassembler(bfdf);
+-#endif
+-	if (disassemble == NULL)
+-		abort();
+-
+-	fflush(s);
+-	do {
+-		const struct bpf_line_info *linfo = NULL;
+-		struct disasm_line *dl;
+-		size_t prev_buf_size;
+-		const char *srcline;
+-		u64 addr;
+-
+-		addr = pc + ((u64 *)(uintptr_t)(info_linear->info.jited_ksyms))[sub_id];
+-		count = disassemble(pc, &info);
+-
+-		if (prog_linfo)
+-			linfo = bpf_prog_linfo__lfind_addr_func(prog_linfo,
+-								addr, sub_id,
+-								nr_skip);
+-
+-		if (linfo && btf) {
+-			srcline = btf__name_by_offset(btf, linfo->line_off);
+-			nr_skip++;
+-		} else
+-			srcline = NULL;
+-
+-		fprintf(s, "\n");
+-		prev_buf_size = buf_size;
+-		fflush(s);
+-
+-		if (!annotate_opts.hide_src_code && srcline) {
+-			args->offset = -1;
+-			args->line = strdup(srcline);
+-			args->line_nr = 0;
+-			args->fileloc = NULL;
+-			args->ms.sym  = sym;
+-			dl = disasm_line__new(args);
+-			if (dl) {
+-				annotation_line__add(&dl->al,
+-						     &notes->src->source);
+-			}
+-		}
+-
+-		args->offset = pc;
+-		args->line = buf + prev_buf_size;
+-		args->line_nr = 0;
+-		args->fileloc = NULL;
+-		args->ms.sym  = sym;
+-		dl = disasm_line__new(args);
+-		if (dl)
+-			annotation_line__add(&dl->al, &notes->src->source);
+-
+-		pc += count;
+-	} while (count > 0 && pc < len);
+-
+-	ret = 0;
+-out:
+-	free(prog_linfo);
+-	btf__free(btf);
+-	fclose(s);
+-	bfd_close(bfdf);
+-	return ret;
+-}
+-#else // defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
+-static int symbol__disassemble_bpf(struct symbol *sym __maybe_unused,
+-				   struct annotate_args *args __maybe_unused)
+-{
+-	return SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF;
+-}
+-#endif // defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
+-
+-static int
+-symbol__disassemble_bpf_image(struct symbol *sym,
+-			      struct annotate_args *args)
+-{
+-	struct annotation *notes = symbol__annotation(sym);
+-	struct disasm_line *dl;
+-
+-	args->offset = -1;
+-	args->line = strdup("to be implemented");
+-	args->line_nr = 0;
+-	args->fileloc = NULL;
+-	dl = disasm_line__new(args);
+-	if (dl)
+-		annotation_line__add(&dl->al, &notes->src->source);
+-
+-	zfree(&args->line);
+-	return 0;
+-}
+-
+ #ifdef HAVE_LIBCAPSTONE_SUPPORT
+ #include <capstone/capstone.h>
+ 
+diff --git a/tools/perf/util/disasm_bpf.c b/tools/perf/util/disasm_bpf.c
+new file mode 100644
+index 000000000000..010b961c4ae9
+--- /dev/null
++++ b/tools/perf/util/disasm_bpf.c
+@@ -0,0 +1,197 @@
++// SPDX-License-Identifier: GPL-2.0-only
++
++#include "util/annotate.h"
++#include "util/disasm_bpf.h"
++#include "util/symbol.h"
++#include <linux/zalloc.h>
++#include <string.h>
++
++#if defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
++#define PACKAGE "perf"
++#include <bfd.h>
++#include <bpf/bpf.h>
++#include <bpf/btf.h>
++#include <bpf/libbpf.h>
++#include <dis-asm.h>
++#include <errno.h>
++#include <linux/btf.h>
++#include <tools/dis-asm-compat.h>
++
++#include "util/bpf-event.h"
++#include "util/bpf-utils.h"
++#include "util/debug.h"
++#include "util/dso.h"
++#include "util/map.h"
++#include "util/env.h"
++#include "util/util.h"
++
++int symbol__disassemble_bpf(struct symbol *sym, struct annotate_args *args)
++{
++	struct annotation *notes = symbol__annotation(sym);
++	struct bpf_prog_linfo *prog_linfo = NULL;
++	struct bpf_prog_info_node *info_node;
++	int len = sym->end - sym->start;
++	disassembler_ftype disassemble;
++	struct map *map = args->ms.map;
++	struct perf_bpil *info_linear;
++	struct disassemble_info info;
++	struct dso *dso = map__dso(map);
++	int pc = 0, count, sub_id;
++	struct btf *btf = NULL;
++	char tpath[PATH_MAX];
++	size_t buf_size;
++	int nr_skip = 0;
++	char *buf;
++	bfd *bfdf;
++	int ret;
++	FILE *s;
++
++	if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO)
++		return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE;
++
++	pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__,
++		  sym->name, sym->start, sym->end - sym->start);
++
++	memset(tpath, 0, sizeof(tpath));
++	perf_exe(tpath, sizeof(tpath));
++
++	bfdf = bfd_openr(tpath, NULL);
++	if (bfdf == NULL)
++		abort();
++
++	if (!bfd_check_format(bfdf, bfd_object))
++		abort();
++
++	s = open_memstream(&buf, &buf_size);
++	if (!s) {
++		ret = errno;
++		goto out;
++	}
++	init_disassemble_info_compat(&info, s,
++				     (fprintf_ftype) fprintf,
++				     fprintf_styled);
++	info.arch = bfd_get_arch(bfdf);
++	info.mach = bfd_get_mach(bfdf);
++
++	info_node = perf_env__find_bpf_prog_info(dso->bpf_prog.env,
++						 dso->bpf_prog.id);
++	if (!info_node) {
++		ret = SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF;
++		goto out;
++	}
++	info_linear = info_node->info_linear;
++	sub_id = dso->bpf_prog.sub_id;
++
++	info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns);
++	info.buffer_length = info_linear->info.jited_prog_len;
++
++	if (info_linear->info.nr_line_info)
++		prog_linfo = bpf_prog_linfo__new(&info_linear->info);
++
++	if (info_linear->info.btf_id) {
++		struct btf_node *node;
++
++		node = perf_env__find_btf(dso->bpf_prog.env,
++					  info_linear->info.btf_id);
++		if (node)
++			btf = btf__new((__u8 *)(node->data),
++				       node->data_size);
++	}
++
++	disassemble_init_for_target(&info);
++
++#ifdef DISASM_FOUR_ARGS_SIGNATURE
++	disassemble = disassembler(info.arch,
++				   bfd_big_endian(bfdf),
++				   info.mach,
++				   bfdf);
++#else
++	disassemble = disassembler(bfdf);
++#endif
++	if (disassemble == NULL)
++		abort();
++
++	fflush(s);
++	do {
++		const struct bpf_line_info *linfo = NULL;
++		struct disasm_line *dl;
++		size_t prev_buf_size;
++		const char *srcline;
++		u64 addr;
++
++		addr = pc + ((u64 *)(uintptr_t)(info_linear->info.jited_ksyms))[sub_id];
++		count = disassemble(pc, &info);
++
++		if (prog_linfo)
++			linfo = bpf_prog_linfo__lfind_addr_func(prog_linfo,
++								addr, sub_id,
++								nr_skip);
++
++		if (linfo && btf) {
++			srcline = btf__name_by_offset(btf, linfo->line_off);
++			nr_skip++;
++		} else
++			srcline = NULL;
++
++		fprintf(s, "\n");
++		prev_buf_size = buf_size;
++		fflush(s);
++
++		if (!annotate_opts.hide_src_code && srcline) {
++			args->offset = -1;
++			args->line = strdup(srcline);
++			args->line_nr = 0;
++			args->fileloc = NULL;
++			args->ms.sym  = sym;
++			dl = disasm_line__new(args);
++			if (dl) {
++				annotation_line__add(&dl->al,
++						     &notes->src->source);
++			}
++		}
++
++		args->offset = pc;
++		args->line = buf + prev_buf_size;
++		args->line_nr = 0;
++		args->fileloc = NULL;
++		args->ms.sym  = sym;
++		dl = disasm_line__new(args);
++		if (dl)
++			annotation_line__add(&dl->al, &notes->src->source);
++
++		pc += count;
++	} while (count > 0 && pc < len);
++
++	ret = 0;
++out:
++	free(prog_linfo);
++	btf__free(btf);
++	fclose(s);
++	bfd_close(bfdf);
++	return ret;
++}
++#else // defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
++int symbol__disassemble_bpf(struct symbol *sym __maybe_unused,
++				   struct annotate_args *args __maybe_unused)
++{
++	return SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF;
++}
++#endif // defined(HAVE_LIBBFD_SUPPORT) && defined(HAVE_LIBBPF_SUPPORT)
++
++int symbol__disassemble_bpf_image(struct symbol *sym, struct annotate_args *args)
++{
++	struct annotation *notes = symbol__annotation(sym);
++	struct disasm_line *dl;
++
++	args->offset = -1;
++	args->line = strdup("to be implemented");
++	args->line_nr = 0;
++	args->fileloc = NULL;
++	dl = disasm_line__new(args);
++	if (dl)
++		annotation_line__add(&dl->al, &notes->src->source);
++
++	zfree(&args->line);
++	return 0;
++}
++
+diff --git a/tools/perf/util/disasm_bpf.h b/tools/perf/util/disasm_bpf.h
+new file mode 100644
+index 000000000000..2ecb19545388
+--- /dev/null
++++ b/tools/perf/util/disasm_bpf.h
+@@ -0,0 +1,12 @@
++// SPDX-License-Identifier: GPL-2.0-only
++
++#ifndef __PERF_DISASM_BPF_H
++#define __PERF_DISASM_BPF_H
++
++struct symbol;
++struct annotate_args;
++
++int symbol__disassemble_bpf(struct symbol *sym, struct annotate_args *args);
++int symbol__disassemble_bpf_image(struct symbol *sym, struct annotate_args *args);
++
++#endif /* __PERF_DISASM_BPF_H */
+-- 
+2.45.2
+

diff --git a/dev-util/perf/perf-6.10.ebuild b/dev-util/perf/perf-6.10.ebuild
index bf643c35c209..c26fcdac95df 100644
--- a/dev-util/perf/perf-6.10.ebuild
+++ b/dev-util/perf/perf-6.10.ebuild
@@ -176,6 +176,7 @@ src_prepare() {
 
 	pushd "${S_K}" >/dev/null || die
 	eapply "${FILESDIR}"/perf-6.4-libtracefs.patch
+	eapply "${FILESDIR}"/perf-6.10-bpf-capstone.patch
 	eapply "${FILESDIR}"/perf-6.10-expr.patch
 	popd || die
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2024-10-04 15:07 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-10-04 15:07 UTC (permalink / raw
  To: gentoo-commits

commit:     082517b39188d4ac99b349cc7367e1653194b513
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  4 15:05:06 2024 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Fri Oct  4 15:07:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=082517b3

dev-util/perf: drop 6.3

Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/Manifest                   |   1 -
 dev-util/perf/files/perf-6.0-c++17.patch |  39 -----
 dev-util/perf/files/perf-6.0-clang.patch |  44 -----
 dev-util/perf/metadata.xml               |   1 -
 dev-util/perf/perf-6.3.ebuild            | 284 -------------------------------
 5 files changed, 369 deletions(-)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index 13b16a36b71d..e2bc9f93960b 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -1,5 +1,4 @@
 DIST linux-6.10.tar.xz 145142812 BLAKE2B bb243ea7493b9d63aa2df2050a3f1ae2b89ee84a20015239cf157e3f4f51c7ac5efedc8a51132b2d7482f9276ac418de6624831c8a3b806130d9c2d2124c539b SHA512 baa2487954044f991d2ae254d77d14a1f0185dd62c9f0fcaff69f586c9f906823017b8db1c4588f27b076dfa3ebb606929fec859f60ea419e7974330b9289cc2
 DIST linux-6.11.tar.xz 146900704 BLAKE2B e7750c0878d71a56a0ce52d4c4c912199dad5bf5e2e8f872585a6494afbb37cbd852e612a6858936d2dc9b7776a3933818f540db408d57e90d18ea5249bba7ab SHA512 329c1f94008742e3f0c2ce7e591a16316d1b2cb9ea4596d4f45604097e07b7aa2f64afa40630a07f321a858455c77aa32ba57b271932ddcf4dc27863f9081cea
-DIST linux-6.3.tar.xz 136891752 BLAKE2B f1887c8924efa8d0cb14c4e604affd0b0168bcf20f56a37c027405c7bc11aba822a43fcb38ccb55a81a26f747d00e1ab5a6554818affbf1e1c7ef5220150fc69 SHA512 768979440f4907ba64d4481b383d6101faf208f27a0b897156123aa278c5743fe3c4f61945b2541429c532d45382aaee8899ea9d44a1d2895bfbb79bfd937f65
 DIST linux-6.7.tar.xz 141406528 BLAKE2B cecdbd19905e43e485ab73b352ced18b37f2a138c97a6956cadcda5d3d271001117dc1cf896b166ff019fc7f405f9539e2ed0d6112b0890efb04d182adf4fd0e SHA512 de06de556191614bd9daf077ae239360352a402bab407748e67f1e5108c92fd933e451707840ab22fe0f9976db3d1e1b60ca9d41cf894f015ca09b3f652b74ad
 DIST patch-6.10.4.xz 303168 BLAKE2B d38bbcdd2f730a030add5b38c1ab09c7081c311ed716d3ae976a058dd34b235078700cdff05d79dc93d9badb75c95566a3bdfc39dfa045d54857d82ee2c92e9d SHA512 5f5e8b19d114fed733c8c98a581fe339f8896e05e5da6a37deb1d7d8aa9dd83b3c80a97b1c6f3f51b6f20cca9c435b20c28c2c511da2026980d9fa72624cf420

diff --git a/dev-util/perf/files/perf-6.0-c++17.patch b/dev-util/perf/files/perf-6.0-c++17.patch
deleted file mode 100644
index 08c34bc552ca..000000000000
--- a/dev-util/perf/files/perf-6.0-c++17.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-https://bugs.gentoo.org/904169
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -309,7 +309,7 @@
- CORE_CFLAGS += -Wextra
- CORE_CFLAGS += -std=gnu11
- 
--CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
-+CXXFLAGS += -std=gnu++17 -fno-exceptions -fno-rtti
- CXXFLAGS += -Wall
- CXXFLAGS += -fno-omit-frame-pointer
- CXXFLAGS += -ggdb3
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -339,7 +339,7 @@
- 	$(BUILD)
- 
- $(OUTPUT)test-llvm.bin:
--	$(BUILDXX) -std=gnu++14 				\
-+	$(BUILDXX) -std=gnu++17 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
- 		$(shell $(LLVM_CONFIG) --libs)			\
-@@ -347,12 +347,12 @@
- 		> $(@:.bin=.make.output) 2>&1
- 
- $(OUTPUT)test-llvm-version.bin:
--	$(BUILDXX) -std=gnu++14					\
-+	$(BUILDXX) -std=gnu++17					\
- 		-I$(shell $(LLVM_CONFIG) --includedir)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
- $(OUTPUT)test-clang.bin:
--	$(BUILDXX) -std=gnu++14					\
-+	$(BUILDXX) -std=gnu++17					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
- 		-lclang-cpp $(shell $(LLVM_CONFIG) --libs)	\
-

diff --git a/dev-util/perf/files/perf-6.0-clang.patch b/dev-util/perf/files/perf-6.0-clang.patch
deleted file mode 100644
index 65b38c8d399b..000000000000
--- a/dev-util/perf/files/perf-6.0-clang.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-
-Adapt for building against LLVM/Clang with monolithic libraries.
-
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -338,7 +338,7 @@ $(OUTPUT)test-llvm.bin:
- 	$(BUILDXX) -std=gnu++14 				\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		$(shell $(LLVM_CONFIG) --libs Core BPF)		\
-+		$(shell $(LLVM_CONFIG) --libs)			\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
-@@ -351,10 +351,7 @@ $(OUTPUT)test-clang.bin:
- 	$(BUILDXX) -std=gnu++14					\
- 		-I$(shell $(LLVM_CONFIG) --includedir) 		\
- 		-L$(shell $(LLVM_CONFIG) --libdir)		\
--		-Wl,--start-group -lclangBasic -lclangDriver	\
--		  -lclangFrontend -lclangEdit -lclangLex	\
--		  -lclangAST -Wl,--end-group 			\
--		$(shell $(LLVM_CONFIG) --libs Core option)	\
-+		-lclang-cpp $(shell $(LLVM_CONFIG) --libs)	\
- 		$(shell $(LLVM_CONFIG) --system-libs)		\
- 		> $(@:.bin=.make.output) 2>&1
- 
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -416,14 +416,11 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
- LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
- 
- ifeq ($(USE_CLANG), 1)
--  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
--  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
--  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
--  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
-+  LIBS += -lclang-cpp
- endif
- 
- ifeq ($(USE_LLVM), 1)
--  LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
-+  LIBLLVM = $(shell $(LLVM_CONFIG) --libs) $(shell $(LLVM_CONFIG) --system-libs)
-   LIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
- endif

diff --git a/dev-util/perf/metadata.xml b/dev-util/perf/metadata.xml
index 89fef8ad07ac..2a4e4eada619 100644
--- a/dev-util/perf/metadata.xml
+++ b/dev-util/perf/metadata.xml
@@ -17,7 +17,6 @@
     <flag name="bpf">Enable support for eBPF features with <pkg>dev-libs/libbpf</pkg></flag>
     <flag name="babeltrace">Enable <pkg>dev-util/babeltrace</pkg> support</flag>
     <flag name="capstone">Use <pkg>dev-libs/capstone</pkg> for disassembly support</flag>
-    <flag name="clang">Enable builtin clang and LLVM support</flag>
     <flag name="doc">
       Build documentation and man pages. With this USE flag disabled,
       the --help parameter for perf and its sub-tools will not be

diff --git a/dev-util/perf/perf-6.3.ebuild b/dev-util/perf/perf-6.3.ebuild
deleted file mode 100644
index 9d36b0ce8ca7..000000000000
--- a/dev-util/perf/perf-6.3.ebuild
+++ /dev/null
@@ -1,284 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{10..11} )
-inherit bash-completion-r1 estack flag-o-matic llvm toolchain-funcs python-r1 linux-info
-
-DESCRIPTION="Userland tools for Linux Performance Counters"
-HOMEPAGE="https://perf.wiki.kernel.org/"
-
-LINUX_V="${PV:0:1}.x"
-if [[ ${PV} == *_rc* ]] ; then
-	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
-	PATCH_VERSION=$(ver_cut 1-3)
-	LINUX_PATCH=patch-${PV//_/-}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
-		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
-elif [[ ${PV} == *.*.* ]] ; then
-	# stable-release series
-	LINUX_VER=$(ver_cut 1-2)
-	LINUX_PATCH=patch-${PV}.xz
-	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
-else
-	LINUX_VER=${PV}
-fi
-
-LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
-SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
-
-S_K="${WORKDIR}/linux-${LINUX_VER}"
-S="${S_K}/tools/perf"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ppc ppc64 ~riscv x86 ~amd64-linux ~x86-linux"
-IUSE="audit babeltrace clang crypt debug +doc gtk java libpfm lzma numa perl python slang systemtap unwind zlib zstd"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-# setuptools (and Python) are always needed even if not building Python bindings
-BDEPEND="
-	${LINUX_PATCH+dev-util/patchutils}
-	${PYTHON_DEPS}
-	>=app-arch/tar-1.34-r2
-	dev-python/setuptools[${PYTHON_USEDEP}]
-	app-alternatives/yacc
-	app-alternatives/lex
-	virtual/pkgconfig
-	doc? (
-		app-text/asciidoc
-		app-text/sgml-common
-		app-text/xmlto
-		sys-process/time
-	)
-"
-
-RDEPEND="audit? ( sys-process/audit )
-	babeltrace? ( dev-util/babeltrace )
-	crypt? ( virtual/libcrypt:= )
-	clang? (
-		sys-devel/clang:=
-		sys-devel/llvm:=
-	)
-	gtk? ( x11-libs/gtk+:2 )
-	java? ( virtual/jre:* )
-	libpfm? ( dev-libs/libpfm )
-	lzma? ( app-arch/xz-utils )
-	numa? ( sys-process/numactl )
-	perl? ( dev-lang/perl:= )
-	python? ( ${PYTHON_DEPS} )
-	slang? ( sys-libs/slang )
-	systemtap? ( dev-debug/systemtap )
-	unwind? ( sys-libs/libunwind )
-	zlib? ( sys-libs/zlib )
-	zstd? ( app-arch/zstd )
-	dev-libs/elfutils
-	sys-libs/binutils-libs:="
-
-DEPEND="${RDEPEND}
-	>=sys-kernel/linux-headers-5.10
-	java? ( virtual/jdk )
-"
-
-CONFIG_CHECK="~PERF_EVENTS ~KALLSYMS"
-
-QA_FLAGS_IGNORED=(
-	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
-	'usr/libexec/perf-core/dlfilters/.*' # plugins
-)
-
-pkg_pretend() {
-	if ! use doc ; then
-		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
-		ewarn "And without man pages, you won't get any --help output for perf and its"
-		ewarn "sub-tools."
-	fi
-}
-
-pkg_setup() {
-	use clang && llvm_pkg_setup
-	# We enable python unconditionally as libbpf always generates
-	# API headers using python script
-	python_setup
-}
-
-# src_unpack and src_prepare are copied to dev-util/bpftool since
-# it's building from the same tarball, please keep it in sync with bpftool
-src_unpack() {
-	local paths=(
-		tools/arch tools/build tools/include tools/lib tools/perf tools/scripts
-		scripts include lib "arch/*/lib"
-	)
-
-	# We expect the tar implementation to support the -j option (both
-	# GNU tar and libarchive's tar support that).
-	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
-	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
-		"${paths[@]/#/linux-${LINUX_VER}/}" || die
-
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		eshopts_push -o noglob
-		ebegin "Filtering partial source patch"
-		filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
-			> ${P}.patch
-		eend $? || die "filterdiff failed"
-		eshopts_pop
-	fi
-
-	local a
-	for a in ${A}; do
-		[[ ${a} == ${LINUX_SOURCES} ]] && continue
-		[[ ${a} == ${LINUX_PATCH} ]] && continue
-		unpack ${a}
-	done
-}
-
-src_prepare() {
-	default
-	if [[ -n ${LINUX_PATCH} ]] ; then
-		pushd "${S_K}" >/dev/null || die
-		eapply "${WORKDIR}"/${P}.patch
-		popd || die
-	fi
-
-	pushd "${S_K}" >/dev/null || die
-	eapply "${FILESDIR}"/perf-6.0-clang.patch
-	eapply "${FILESDIR}"/perf-6.0-c++17.patch
-	popd || die
-
-	# Drop some upstream too-developer-oriented flags and fix the
-	# Makefile in general
-	sed -i \
-		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
-		"${S}"/Makefile.perf || die
-	# A few places still use -Werror w/out $(WERROR) protection.
-	sed -i -e 's@-Werror@@' \
-		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile \
-		"${S_K}"/tools/lib/perf/Makefile || die
-
-	# Avoid the call to make kernelversion
-	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
-	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
-
-	# The code likes to compile local assembly files which lack ELF markings.
-	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
-}
-
-puse() { usex $1 "" no; }
-perf_make() {
-	# The arch parsing is a bit funky.  The perf tools package is integrated
-	# into the kernel, so it wants an ARCH that looks like the kernel arch,
-	# but it also wants to know about the split value -- i386/x86_64 vs just
-	# x86.  We can get that by telling the func to use an older linux version.
-	# It's kind of a hack, but not that bad ...
-
-	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
-
-	local arch=$(tc-arch-kernel)
-	local java_dir
-	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
-
-	# sync this with the whitelist in tools/perf/Makefile.config
-	local disable_libdw
-	if ! use amd64 && ! use x86 && \
-	   ! use arm && \
-	   ! use arm64 && \
-	   ! use ppc && ! use ppc64 \
-	   ! use s390 && \
-	   ! use riscv
-	then
-		disable_libdw=1
-	fi
-
-	# FIXME: NO_CORESIGHT
-	emake V=1 VF=1 \
-		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
-		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="$(tc-getLD)" NM="$(tc-getNM)" \
-		CLANG="${CHOST}-clang" \
-		PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-		prefix="${EPREFIX}/usr" bindir_relative="bin" \
-		tipdir="share/doc/${PF}" \
-		EXTRA_CFLAGS="${CFLAGS}" \
-		EXTRA_LDFLAGS="${LDFLAGS}" \
-		ARCH="${arch}" \
-		JDIR="${java_dir}" \
-		LIBCLANGLLVM=$(usex clang 1 "") \
-		LIBPFM4=$(usex libpfm 1 "") \
-		NO_AUXTRACE="" \
-		NO_BACKTRACE="" \
-		NO_CORESIGHT=1 \
-		NO_DEMANGLE= \
-		GTK2=$(usex gtk 1 "") \
-		feature-gtk2-infobar=$(usex gtk 1 "") \
-		NO_JVMTI=$(puse java) \
-		NO_LIBAUDIT=$(puse audit) \
-		NO_LIBBABELTRACE=$(puse babeltrace) \
-		NO_LIBBIONIC=1 \
-		NO_LIBBPF= \
-		NO_LIBCRYPTO=$(puse crypt) \
-		NO_LIBDW_DWARF_UNWIND="${disable_libdw}" \
-		NO_LIBELF= \
-		NO_LIBNUMA=$(puse numa) \
-		NO_LIBPERL=$(puse perl) \
-		NO_LIBPYTHON=$(puse python) \
-		NO_LIBUNWIND=$(puse unwind) \
-		NO_LIBZSTD=$(puse zstd) \
-		NO_SDT=$(puse systemtap) \
-		NO_SLANG=$(puse slang) \
-		NO_LZMA=$(puse lzma) \
-		NO_ZLIB=$(puse zlib) \
-		WERROR=0 \
-		LIBDIR="/usr/libexec/perf-core" \
-		libdir="${EPREFIX}/usr/$(get_libdir)" \
-		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins" \
-		"$@"
-}
-
-src_compile() {
-	filter-lto
-
-	# test-clang.bin not build with g++
-	if use clang; then
-		make -C "${S_K}/tools/build/feature" V=1 CXX=${CHOST}-clang++ test-clang.bin || die
-	fi
-	perf_make -f Makefile.perf
-	use doc && perf_make -C Documentation man
-}
-
-src_test() {
-	:
-}
-
-src_install() {
-	_install_python_ext() {
-		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
-	}
-
-	perf_make -f Makefile.perf install DESTDIR="${D}"
-
-	if use python; then
-		python_foreach_impl _install_python_ext
-	fi
-
-	if use gtk; then
-		local libdir
-		libdir="$(get_libdir)"
-		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
-		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
-		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
-			"${ED}"/usr/libexec/perf-core || die
-	fi
-
-	dodoc CREDITS
-
-	dodoc *txt Documentation/*.txt
-
-	# perf needs this decompressed to print out tips for users
-	docompress -x /usr/share/doc/${PF}/tips.txt
-
-	if use doc ; then
-		doman Documentation/*.1
-	fi
-}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/
@ 2024-11-11 16:15 Guilherme Amadio
  0 siblings, 0 replies; 9+ messages in thread
From: Guilherme Amadio @ 2024-11-11 16:15 UTC (permalink / raw
  To: gentoo-commits

commit:     e7fd7b802eede73629109b18642583e3400d7bea
Author:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 11 12:52:08 2024 +0000
Commit:     Guilherme Amadio <amadio <AT> gentoo <DOT> org>
CommitDate: Mon Nov 11 16:15:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7fd7b80

dev-util/perf: add 6.11.7

Closes: https://bugs.gentoo.org/943203
Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>

 dev-util/perf/Manifest                         |   1 +
 dev-util/perf/files/perf-6.11.7-annotate.patch |  19 ++
 dev-util/perf/perf-6.11.7.ebuild               | 346 +++++++++++++++++++++++++
 3 files changed, 366 insertions(+)

diff --git a/dev-util/perf/Manifest b/dev-util/perf/Manifest
index e2bc9f93960b..737f8c32fd88 100644
--- a/dev-util/perf/Manifest
+++ b/dev-util/perf/Manifest
@@ -2,3 +2,4 @@ DIST linux-6.10.tar.xz 145142812 BLAKE2B bb243ea7493b9d63aa2df2050a3f1ae2b89ee84
 DIST linux-6.11.tar.xz 146900704 BLAKE2B e7750c0878d71a56a0ce52d4c4c912199dad5bf5e2e8f872585a6494afbb37cbd852e612a6858936d2dc9b7776a3933818f540db408d57e90d18ea5249bba7ab SHA512 329c1f94008742e3f0c2ce7e591a16316d1b2cb9ea4596d4f45604097e07b7aa2f64afa40630a07f321a858455c77aa32ba57b271932ddcf4dc27863f9081cea
 DIST linux-6.7.tar.xz 141406528 BLAKE2B cecdbd19905e43e485ab73b352ced18b37f2a138c97a6956cadcda5d3d271001117dc1cf896b166ff019fc7f405f9539e2ed0d6112b0890efb04d182adf4fd0e SHA512 de06de556191614bd9daf077ae239360352a402bab407748e67f1e5108c92fd933e451707840ab22fe0f9976db3d1e1b60ca9d41cf894f015ca09b3f652b74ad
 DIST patch-6.10.4.xz 303168 BLAKE2B d38bbcdd2f730a030add5b38c1ab09c7081c311ed716d3ae976a058dd34b235078700cdff05d79dc93d9badb75c95566a3bdfc39dfa045d54857d82ee2c92e9d SHA512 5f5e8b19d114fed733c8c98a581fe339f8896e05e5da6a37deb1d7d8aa9dd83b3c80a97b1c6f3f51b6f20cca9c435b20c28c2c511da2026980d9fa72624cf420
+DIST patch-6.11.7.xz 669756 BLAKE2B f2ec79bd337eaa61c7203c00ce61b3e5afa9eee38a3e38e63a7fc9270af86674e5c369ca7ddfe4fa5f79601b1c874af1ce732bd8987529c7db2f2f9ca54ba85b SHA512 031c22e2fa7e1c7808f50dc2120a35d10a0b81d30636c5d19146fe12558999517f132213b72c39a32d8cc2c0e14e16ff64cac63ef97f8be0ebe8e709a3de8156

diff --git a/dev-util/perf/files/perf-6.11.7-annotate.patch b/dev-util/perf/files/perf-6.11.7-annotate.patch
new file mode 100644
index 000000000000..ca6e7bb07cba
--- /dev/null
+++ b/dev-util/perf/files/perf-6.11.7-annotate.patch
@@ -0,0 +1,19 @@
+
+Fix for bug #943203.
+
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5363c306787c88d41a41493f81b4308643696f6e
+
+diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
+index a18927d792afc5..3bbf173ad822bc 100644
+--- a/tools/perf/util/symbol.c
++++ b/tools/perf/util/symbol.c
+@@ -1931,6 +1931,9 @@ int dso__load(struct dso *dso, struct map *map)
+ 		if (next_slot) {
+ 			ss_pos++;
+ 
++			if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND)
++				dso__set_binary_type(dso, symtab_type);
++
+ 			if (syms_ss && runtime_ss)
+ 				break;
+ 		} else {

diff --git a/dev-util/perf/perf-6.11.7.ebuild b/dev-util/perf/perf-6.11.7.ebuild
new file mode 100644
index 000000000000..1ad4d3bf3cda
--- /dev/null
+++ b/dev-util/perf/perf-6.11.7.ebuild
@@ -0,0 +1,346 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( {16..19} )
+PYTHON_COMPAT=( python3_{10..13} )
+inherit bash-completion-r1 estack flag-o-matic linux-info llvm-r1 toolchain-funcs python-r1
+
+DESCRIPTION="Userland tools for Linux Performance Counters"
+HOMEPAGE="https://perf.wiki.kernel.org/"
+
+LINUX_V="${PV:0:1}.x"
+if [[ ${PV} == *_rc* ]] ; then
+	LINUX_VER=$(ver_cut 1-2).$(($(ver_cut 3)-1))
+	PATCH_VERSION=$(ver_cut 1-3)
+	LINUX_PATCH=patch-${PV//_/-}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/${LINUX_PATCH}
+		https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/testing/v${PATCH_VERSION}/${LINUX_PATCH}"
+elif [[ ${PV} == *.*.* ]] ; then
+	# stable-release series
+	LINUX_VER=$(ver_cut 1-2)
+	LINUX_PATCH=patch-${PV}.xz
+	SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
+else
+	LINUX_VER=${PV}
+fi
+
+LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
+SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
+
+S_K="${WORKDIR}/linux-${LINUX_VER}"
+S="${S_K}/tools/perf"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+IUSE="abi_mips_o32 abi_mips_n32 abi_mips_n64 audit babeltrace capstone big-endian bpf caps crypt debug +doc gtk java libpfm +libtraceevent +libtracefs lzma numa perl python slang systemtap tcmalloc unwind zstd"
+
+REQUIRED_USE="
+	${PYTHON_REQUIRED_USE}
+"
+
+# setuptools (and Python) are always needed even if not building Python bindings
+BDEPEND="
+	${LINUX_PATCH+dev-util/patchutils}
+	${PYTHON_DEPS}
+	>=app-arch/tar-1.34-r2
+	dev-python/setuptools[${PYTHON_USEDEP}]
+	app-alternatives/yacc
+	app-alternatives/lex
+	virtual/pkgconfig
+	doc? (
+		app-text/asciidoc
+		app-text/sgml-common
+		app-text/xmlto
+		sys-process/time
+	)
+"
+
+RDEPEND="
+	audit? ( sys-process/audit )
+	babeltrace? ( dev-util/babeltrace:0/1 )
+	bpf? (
+		dev-libs/libbpf
+		dev-util/bpftool
+		dev-util/pahole
+		$(llvm_gen_dep '
+			sys-devel/clang:${LLVM_SLOT}=
+			sys-devel/llvm:${LLVM_SLOT}=
+		')
+	)
+	caps? ( sys-libs/libcap )
+	capstone? ( dev-libs/capstone )
+	crypt? ( dev-libs/openssl:= )
+	gtk? ( x11-libs/gtk+:2 )
+	java? ( virtual/jre:* )
+	libpfm? ( dev-libs/libpfm:= )
+	libtraceevent? ( dev-libs/libtraceevent )
+	libtracefs? ( dev-libs/libtracefs )
+	lzma? ( app-arch/xz-utils )
+	numa? ( sys-process/numactl )
+	perl? ( dev-lang/perl:= )
+	python? ( ${PYTHON_DEPS} )
+	slang? ( sys-libs/slang )
+	systemtap? ( dev-debug/systemtap )
+	tcmalloc? ( dev-util/google-perftools )
+	unwind? ( sys-libs/libunwind:= )
+	zstd? ( app-arch/zstd:= )
+	dev-libs/elfutils
+	sys-libs/binutils-libs:=
+	sys-libs/zlib
+	virtual/libcrypt
+"
+
+DEPEND="${RDEPEND}
+	>=sys-kernel/linux-headers-5.10
+	java? ( virtual/jdk )
+"
+
+QA_FLAGS_IGNORED=(
+	'usr/bin/perf-read-vdso32' # not linked with anything except for libc
+	'usr/libexec/perf-core/dlfilters/.*' # plugins
+)
+
+pkg_pretend() {
+	if ! use doc ; then
+		ewarn "Without the doc USE flag you won't get any documentation nor man pages."
+		ewarn "And without man pages, you won't get any --help output for perf and its"
+		ewarn "sub-tools."
+	fi
+}
+
+pkg_setup() {
+	local CONFIG_CHECK="
+		~DEBUG_INFO
+		~FTRACE
+		~FTRACE_SYSCALLS
+		~FUNCTION_TRACER
+		~KALLSYMS
+		~KALLSYMS_ALL
+		~KPROBES
+		~KPROBE_EVENTS
+		~PERF_EVENTS
+		~UPROBES
+		~UPROBE_EVENTS
+	"
+
+	use bpf && llvm-r1_pkg_setup
+	# We enable python unconditionally as libbpf always generates
+	# API headers using python script
+	python_setup
+
+	if use bpf ; then
+		CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT"
+	fi
+
+	linux-info_pkg_setup
+}
+
+# src_unpack and src_prepare are copied to dev-util/bpftool since
+# it's building from the same tarball, please keep it in sync with bpftool
+src_unpack() {
+	local paths=(
+		'arch/*/include/*' 'arch/*/lib/*' 'arch/*/tools/*' 'include/*'
+		'kernel/bpf/*' 'lib/*' 'scripts/*' 'tools/arch/*' 'tools/bpf/*'
+		'tools/build/*' 'tools/include/*' 'tools/lib/*' 'tools/perf/*'
+		'tools/scripts/*'
+	)
+
+	# We expect the tar implementation to support the -j option (both
+	# GNU tar and libarchive's tar support that).
+	echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
+	gtar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
+		"${paths[@]/#/linux-${LINUX_VER}/}" || die
+
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		eshopts_push -o noglob
+		ebegin "Filtering partial source patch"
+		xzcat "${DISTDIR}"/${LINUX_PATCH} | filterdiff -p1 ${paths[@]/#/-i} > ${P}.patch
+		assert -n "Unpacking to ${P} from ${DISTDIR}/${LINUX_PATCH} failed"
+		eend $? || die "filterdiff failed"
+		test -s ${P}.patch || die "patch is empty?!"
+		eshopts_pop
+	fi
+
+	local a
+	for a in ${A}; do
+		[[ ${a} == ${LINUX_SOURCES} ]] && continue
+		[[ ${a} == ${LINUX_PATCH} ]] && continue
+		unpack ${a}
+	done
+}
+
+src_prepare() {
+	default
+	if [[ -n ${LINUX_PATCH} ]] ; then
+		pushd "${S_K}" >/dev/null || die
+		eapply "${WORKDIR}"/${P}.patch
+		eapply "${FILESDIR}"/perf-6.11.7-annotate.patch
+		popd || die
+	fi
+
+	pushd "${S_K}" >/dev/null || die
+	popd || die
+
+	# Drop some upstream too-developer-oriented flags and fix the
+	# Makefile in general
+	sed -i \
+		-e "s@\$(sysconfdir_SQ)/bash_completion.d@$(get_bashcompdir)@" \
+		"${S}"/Makefile.perf || die
+	# A few places still use -Werror w/out $(WERROR) protection.
+	sed -i -e 's@-Werror@@' \
+		"${S}"/Makefile.perf "${S_K}"/tools/lib/bpf/Makefile \
+		"${S_K}"/tools/lib/perf/Makefile || die
+
+	# Avoid the call to make kernelversion
+	sed -i -e '/PERF-VERSION-GEN/d' Makefile.perf || die
+	echo "#define PERF_VERSION \"${PV}\"" > PERF-VERSION-FILE
+
+	# The code likes to compile local assembly files which lack ELF markings.
+	find -name '*.S' -exec sed -i '$a.section .note.GNU-stack,"",%progbits' {} +
+}
+
+puse() { usex $1 "" 1; }
+perf_make() {
+	# The arch parsing is a bit funky.  The perf tools package is integrated
+	# into the kernel, so it wants an ARCH that looks like the kernel arch,
+	# but it also wants to know about the split value -- i386/x86_64 vs just
+	# x86.  We can get that by telling the func to use an older linux version.
+	# It's kind of a hack, but not that bad ...
+
+	# LIBDIR sets a search path of perf-gtk.so. Bug 515954
+
+	local arch=$(tc-arch-kernel)
+	local java_dir
+	use java && java_dir="${EPREFIX}/etc/java-config-2/current-system-vm"
+
+	# sync this with the whitelist in tools/perf/Makefile.config
+	local disable_libdw
+	if ! use amd64 && ! use x86 && \
+	   ! use arm && \
+	   ! use arm64 && \
+	   ! use ppc && ! use ppc64 \
+	   ! use s390 && \
+	   ! use riscv && \
+	   ! use loong
+	then
+		disable_libdw=1
+	fi
+
+	# perf directly invokes LD for linking without going through CC, on mips
+	# it is required to specify the emulation.  port of below buildroot patch
+	# https://patchwork.ozlabs.org/project/buildroot/patch/20170217105905.32151-1-Vincent.Riera@imgtec.com/
+	local linker="$(tc-getLD)"
+	if use mips
+	then
+		if use big-endian
+		then
+			use abi_mips_n64 && linker+=" -m elf64btsmip"
+			use abi_mips_n32 && linker+=" -m elf32btsmipn32"
+			use abi_mips_o32 && linker+=" -m elf32btsmip"
+		else
+			use abi_mips_n64 && linker+=" -m elf64ltsmip"
+			use abi_mips_n32 && linker+=" -m elf32ltsmipn32"
+			use abi_mips_o32 && linker+=" -m elf32ltsmip"
+		fi
+	fi
+
+	# FIXME: NO_CORESIGHT
+	local emakeargs=(
+		V=1 VF=1
+		HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)"
+		CC="$(tc-getCC)" CXX="$(tc-getCXX)" AR="$(tc-getAR)" LD="${linker}" NM="$(tc-getNM)"
+		CLANG="${CHOST}-clang"
+		PKG_CONFIG="$(tc-getPKG_CONFIG)"
+		prefix="${EPREFIX}/usr" bindir_relative="bin"
+		tipdir="share/doc/${PF}"
+		EXTRA_CFLAGS="${CFLAGS}"
+		EXTRA_LDFLAGS="${LDFLAGS}"
+		ARCH="${arch}"
+		BUILD_BPF_SKEL=$(usex bpf 1 "") \
+		BUILD_NONDISTRO=1
+		JDIR="${java_dir}"
+		CORESIGHT=
+		GTK2=$(usex gtk 1 "")
+		feature-gtk2-infobar=$(usex gtk 1 "")
+		NO_AUXTRACE=
+		NO_BACKTRACE=
+		NO_CAPSTONE=$(puse capstone)
+		NO_DEMANGLE=
+		NO_JEVENTS=$(puse python)
+		NO_JVMTI=$(puse java)
+		NO_LIBAUDIT=$(puse audit)
+		NO_LIBBABELTRACE=$(puse babeltrace)
+		NO_LIBBIONIC=1
+		NO_LIBBPF=$(puse bpf)
+		NO_LIBCAP=$(puse caps)
+		NO_LIBCRYPTO=$(puse crypt)
+		NO_LIBDW_DWARF_UNWIND="${disable_libdw}"
+		NO_LIBELF=
+		NO_LIBNUMA=$(puse numa)
+		NO_LIBPERL=$(puse perl)
+		NO_LIBPFM4=$(puse libpfm)
+		NO_LIBPYTHON=$(puse python)
+		NO_LIBTRACEEVENT=$(puse libtraceevent)
+		NO_LIBUNWIND=$(puse unwind)
+		NO_LIBZSTD=$(puse zstd)
+		NO_SDT=$(puse systemtap)
+		NO_SHELLCHECK=1
+		NO_SLANG=$(puse slang)
+		NO_LZMA=$(puse lzma)
+		NO_ZLIB=
+		TCMALLOC=$(usex tcmalloc 1 "")
+		WERROR=0
+		DEBUG=$(usex debug 1 "")
+		LIBDIR="/usr/libexec/perf-core"
+		libdir="${EPREFIX}/usr/$(get_libdir)"
+		plugindir="${EPREFIX}/usr/$(get_libdir)/perf/plugins"
+		"$@"
+	)
+	emake "${emakeargs[@]}"
+}
+
+src_compile() {
+	filter-lto
+
+	perf_make -f Makefile.perf
+	use doc && perf_make -C Documentation man
+}
+
+src_test() {
+	:
+}
+
+src_install() {
+	_install_python_ext() {
+		perf_make -f Makefile.perf install-python_ext DESTDIR="${D}"
+	}
+
+	perf_make -f Makefile.perf install DESTDIR="${D}"
+
+	if use python; then
+		python_foreach_impl _install_python_ext
+	fi
+
+	if use gtk; then
+		local libdir
+		libdir="$(get_libdir)"
+		# on some arches it ends up in lib even on 64bit, ppc64 for instance.
+		[[ -f "${ED}"/usr/lib/libperf-gtk.so ]] && libdir="lib"
+		mv "${ED}"/usr/${libdir}/libperf-gtk.so \
+			"${ED}"/usr/libexec/perf-core || die
+	fi
+
+	dodoc CREDITS
+
+	dodoc *txt Documentation/*.txt
+
+	# perf needs this decompressed to print out tips for users
+	docompress -x /usr/share/doc/${PF}/tips.txt
+
+	if use doc ; then
+		doman Documentation/*.1
+	fi
+}


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-11-11 16:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-15 16:05 [gentoo-commits] repo/gentoo:master commit in: dev-util/perf/files/, dev-util/perf/ Yixun Lan
  -- strict thread matches above, loose matches on Subject: below --
2021-11-11  8:56 Guilherme Amadio
2022-11-17  5:09 Michał Górny
2023-04-15  5:13 Sam James
2023-07-06  7:44 Guilherme Amadio
2023-07-06 16:12 Guilherme Amadio
2024-08-06 10:16 Guilherme Amadio
2024-10-04 15:07 Guilherme Amadio
2024-11-11 16:15 Guilherme Amadio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox