Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] linux-tools 6.5
@ 2023-09-05 13:29 sgn
  2023-09-05 14:21 ` [PR PATCH] [Updated] " sgn
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: sgn @ 2023-09-05 13:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 37795 bytes --]

From cbfa0320a48bf012cac1e0f79a2cec0dc8ac5c33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/3] New package: libpfm4-4.13.0

---
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++
 srcpkgs/libpfm4/template                   | 63 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 4 files changed, 108 insertions(+)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..3bad5ca7a17b9
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,63 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+depends=""
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Expat"
+homepage="https://perfmon2.sourceforge.net/"
+#changelog=""
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From c130926e7d9d6189eacce5978b07525cdb5cbcc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/3] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 50ff8e2002f90f5b4afa5f912519869969aea837 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/3] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
@ 2023-09-05 14:21 ` sgn
  2023-09-05 15:14 ` sgn
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-05 14:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 43034 bytes --]

From 29b4f52d74b0811fac742f64344d81d633e81b2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 54 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 100 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..7d488008ce6e4
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,54 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Expat"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 210da78b96fea3e6a343deef9d95141982fe1717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 24be43492a1274a4d6eebe33319288da4922fd71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From 58b26715493772e156c16cedca29cdca17c90da7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 19 ++++---
 4 files changed, 14 insertions(+), 75 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..b0a7d5249daac 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,34 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime"
+makedepends="libpfm4-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 if [ -n "$CROSS_BUILD" ]; then
 	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
+	configure_args+=" --with-CPU=${_ARCH} --with-arch=${_ARCH}"
 fi
 
 case "$XBPS_TARGET_MACHINE" in
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
 esac
 
+post_extract() {
+	rm -rf libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
  2023-09-05 14:21 ` [PR PATCH] [Updated] " sgn
@ 2023-09-05 15:14 ` sgn
  2023-09-05 15:17 ` sgn
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-05 15:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 55895 bytes --]

From 29b4f52d74b0811fac742f64344d81d633e81b2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/5] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 54 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 100 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..7d488008ce6e4
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,54 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Expat"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 210da78b96fea3e6a343deef9d95141982fe1717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/5] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 24be43492a1274a4d6eebe33319288da4922fd71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/5] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From 58b26715493772e156c16cedca29cdca17c90da7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/5] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 19 ++++---
 4 files changed, 14 insertions(+), 75 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..b0a7d5249daac 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,34 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime"
+makedepends="libpfm4-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 if [ -n "$CROSS_BUILD" ]; then
 	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
+	configure_args+=" --with-CPU=${_ARCH} --with-arch=${_ARCH}"
 fi
 
 case "$XBPS_TARGET_MACHINE" in
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
 esac
 
+post_extract() {
+	rm -rf libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

From 5044732399ec255d35ad4a36a2284fc685fcd1f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 22:14:11 +0700
Subject: [PATCH 5/5] fixup! papi: update to 7.0.1.

---
 .../patches/fortran-line-continuation.patch   | 143 ++++++++++++++++++
 srcpkgs/papi/template                         |  21 ++-
 2 files changed, 157 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/papi/patches/fortran-line-continuation.patch

diff --git a/srcpkgs/papi/patches/fortran-line-continuation.patch b/srcpkgs/papi/patches/fortran-line-continuation.patch
new file mode 100644
index 0000000000000..770886f86930a
--- /dev/null
+++ b/srcpkgs/papi/patches/fortran-line-continuation.patch
@@ -0,0 +1,143 @@
+--- a/src/components/sysdetect/tests/query_device_simple_f.F
++++ b/src/components/sysdetect/tests/query_device_simple_f.F
+@@ -41,54 +41,54 @@
+               if (id == PAPI_DEV_TYPE_ID__CPU .and. dev_count > 0) then
+                   numas = 1
+                   do i = 0, dev_count - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass, &
+-                          dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass,
++     &                    dummy_str, ret_val)
+ 
+                       print *, 'Vendor             : ', trim(vendor_name), '(', vendor_id, ')'
+                       print *, 'Id                 : ', i
+@@ -101,27 +101,27 @@
+                       print *, 'SMT/core           : ', threads / sockets / cores
+ 
+                       if (l1i_size > 0) then
+-                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ', &
+-                              l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
+-                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ', &
+-                              l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
++                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ',
++     &                        l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
++                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ',
++     &                        l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
+                       endif
+ 
+                       if (l2u_size > 0) then
+-                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ', &
+-                              l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
++                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ',
++     &                        l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
+                       endif
+ 
+                       if (l3u_size > 0) then
+-                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ', &
+-                              l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
++                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ',
++     &                        l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
+                       endif
+ 
+                   enddo
+ 
+                   do i = 0, numas - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE, &
+-                          mem_size, dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE,
++     &                    mem_size, dummy_str, ret_val)
+                   enddo
+               endif
+               call papif_enum_dev_type(modifier, handle, ret_val)
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b0a7d5249daac..5ac36d2162bba 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -6,8 +6,9 @@ build_wrksrc="src"
 build_style=gnu-configure
 configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
  --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
- --with-walltimer=clock_realtime"
-makedepends="libpfm4-devel"
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran"
+makedepends="libpfm4-devel libgomp-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
@@ -16,15 +17,21 @@ distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
 checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
 python_version=3
 
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
-
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+if [ -z "$CROSS_BUILD" ]; then
+	hostmakedepends+=" openmpi"
+	makedepends+=" openmpi-devel"
+fi
+
 post_extract() {
 	rm -rf libpfm*
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
  2023-09-05 14:21 ` [PR PATCH] [Updated] " sgn
  2023-09-05 15:14 ` sgn
@ 2023-09-05 15:17 ` sgn
  2023-09-05 23:58 ` sgn
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-05 15:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 57274 bytes --]

From 29b4f52d74b0811fac742f64344d81d633e81b2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/6] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 54 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 100 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..7d488008ce6e4
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,54 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Expat"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 210da78b96fea3e6a343deef9d95141982fe1717 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/6] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 24be43492a1274a4d6eebe33319288da4922fd71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/6] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From 58b26715493772e156c16cedca29cdca17c90da7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/6] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 19 ++++---
 4 files changed, 14 insertions(+), 75 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..b0a7d5249daac 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,34 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime"
+makedepends="libpfm4-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 if [ -n "$CROSS_BUILD" ]; then
 	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
+	configure_args+=" --with-CPU=${_ARCH} --with-arch=${_ARCH}"
 fi
 
 case "$XBPS_TARGET_MACHINE" in
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
 esac
 
+post_extract() {
+	rm -rf libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

From 5044732399ec255d35ad4a36a2284fc685fcd1f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 22:14:11 +0700
Subject: [PATCH 5/6] fixup! papi: update to 7.0.1.

---
 .../patches/fortran-line-continuation.patch   | 143 ++++++++++++++++++
 srcpkgs/papi/template                         |  21 ++-
 2 files changed, 157 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/papi/patches/fortran-line-continuation.patch

diff --git a/srcpkgs/papi/patches/fortran-line-continuation.patch b/srcpkgs/papi/patches/fortran-line-continuation.patch
new file mode 100644
index 0000000000000..770886f86930a
--- /dev/null
+++ b/srcpkgs/papi/patches/fortran-line-continuation.patch
@@ -0,0 +1,143 @@
+--- a/src/components/sysdetect/tests/query_device_simple_f.F
++++ b/src/components/sysdetect/tests/query_device_simple_f.F
+@@ -41,54 +41,54 @@
+               if (id == PAPI_DEV_TYPE_ID__CPU .and. dev_count > 0) then
+                   numas = 1
+                   do i = 0, dev_count - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass, &
+-                          dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass,
++     &                    dummy_str, ret_val)
+ 
+                       print *, 'Vendor             : ', trim(vendor_name), '(', vendor_id, ')'
+                       print *, 'Id                 : ', i
+@@ -101,27 +101,27 @@
+                       print *, 'SMT/core           : ', threads / sockets / cores
+ 
+                       if (l1i_size > 0) then
+-                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ', &
+-                              l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
+-                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ', &
+-                              l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
++                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ',
++     &                        l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
++                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ',
++     &                        l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
+                       endif
+ 
+                       if (l2u_size > 0) then
+-                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ', &
+-                              l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
++                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ',
++     &                        l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
+                       endif
+ 
+                       if (l3u_size > 0) then
+-                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ', &
+-                              l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
++                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ',
++     &                        l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
+                       endif
+ 
+                   enddo
+ 
+                   do i = 0, numas - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE, &
+-                          mem_size, dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE,
++     &                    mem_size, dummy_str, ret_val)
+                   enddo
+               endif
+               call papif_enum_dev_type(modifier, handle, ret_val)
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b0a7d5249daac..5ac36d2162bba 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -6,8 +6,9 @@ build_wrksrc="src"
 build_style=gnu-configure
 configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
  --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
- --with-walltimer=clock_realtime"
-makedepends="libpfm4-devel"
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran"
+makedepends="libpfm4-devel libgomp-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
@@ -16,15 +17,21 @@ distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
 checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
 python_version=3
 
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
-
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+if [ -z "$CROSS_BUILD" ]; then
+	hostmakedepends+=" openmpi"
+	makedepends+=" openmpi-devel"
+fi
+
 post_extract() {
 	rm -rf libpfm*
 }

From 63f17a57a76e8141407da4f666ac2adc60914a8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 22:17:44 +0700
Subject: [PATCH 6/6] fixup! fixup! papi: update to 7.0.1.

---
 srcpkgs/papi/template | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index 5ac36d2162bba..3663b4a0b5c15 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -7,8 +7,8 @@ build_style=gnu-configure
 configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
  --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
  --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
-hostmakedepends="gcc-fortran"
-makedepends="libpfm4-devel libgomp-devel"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
@@ -27,10 +27,10 @@ case "$XBPS_TARGET_MACHINE" in
 	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
-if [ -z "$CROSS_BUILD" ]; then
-	hostmakedepends+=" openmpi"
-	makedepends+=" openmpi-devel"
-fi
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
 
 post_extract() {
 	rm -rf libpfm*

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (2 preceding siblings ...)
  2023-09-05 15:17 ` sgn
@ 2023-09-05 23:58 ` sgn
  2023-09-06  0:01 ` sgn
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-05 23:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 54403 bytes --]

From a8ecef679003dd00bc32124421143c5f173593ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 56 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 102 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..3067c903020e8
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,56 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Expat"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+conflicts="papi<7.0.0_1"
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	conflicts="papi-devel<7.0.0_1"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 3a0a1760962951ef99391881d133043d07f1afd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 8cb6dca1027812ef89dc7960007119d61d99d6f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From fd0d5ad95a4e99eb5372b530fa8958e44ea0cf92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                 |   2 +-
 .../patches/fortran-line-continuation.patch   | 143 ++++++++++++++++++
 srcpkgs/papi/patches/gnu_source.patch         |  12 --
 srcpkgs/papi/patches/use-after-realloc.patch  |  56 -------
 srcpkgs/papi/template                         |  34 +++--
 5 files changed, 168 insertions(+), 79 deletions(-)
 create mode 100644 srcpkgs/papi/patches/fortran-line-continuation.patch
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/fortran-line-continuation.patch b/srcpkgs/papi/patches/fortran-line-continuation.patch
new file mode 100644
index 0000000000000..770886f86930a
--- /dev/null
+++ b/srcpkgs/papi/patches/fortran-line-continuation.patch
@@ -0,0 +1,143 @@
+--- a/src/components/sysdetect/tests/query_device_simple_f.F
++++ b/src/components/sysdetect/tests/query_device_simple_f.F
+@@ -41,54 +41,54 @@
+               if (id == PAPI_DEV_TYPE_ID__CPU .and. dev_count > 0) then
+                   numas = 1
+                   do i = 0, dev_count - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass, &
+-                          dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass,
++     &                    dummy_str, ret_val)
+ 
+                       print *, 'Vendor             : ', trim(vendor_name), '(', vendor_id, ')'
+                       print *, 'Id                 : ', i
+@@ -101,27 +101,27 @@
+                       print *, 'SMT/core           : ', threads / sockets / cores
+ 
+                       if (l1i_size > 0) then
+-                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ', &
+-                              l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
+-                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ', &
+-                              l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
++                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ',
++     &                        l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
++                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ',
++     &                        l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
+                       endif
+ 
+                       if (l2u_size > 0) then
+-                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ', &
+-                              l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
++                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ',
++     &                        l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
+                       endif
+ 
+                       if (l3u_size > 0) then
+-                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ', &
+-                              l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
++                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ',
++     &                        l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
+                       endif
+ 
+                   enddo
+ 
+                   do i = 0, numas - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE, &
+-                          mem_size, dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE,
++     &                    mem_size, dummy_str, ret_val)
+                   enddo
+               endif
+               call papif_enum_dev_type(modifier, handle, ret_val)
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..3663b4a0b5c15 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,41 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
-
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
+
+post_extract() {
+	rm -rf libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (3 preceding siblings ...)
  2023-09-05 23:58 ` sgn
@ 2023-09-06  0:01 ` sgn
  2023-09-06  1:12 ` sgn
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-06  0:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 54401 bytes --]

From 81d92e091be2d85c7a7796a50bf7f3b582e6664d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 56 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 102 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..b11551a610ea3
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,56 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="MIT"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+conflicts="papi<7.0.0_1"
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	conflicts="papi-devel<7.0.0_1"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 12f3fb51d0ced78b48baa20a128b7e5d9b0e9f2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 311095b4abea866b545109c31f37072b6d28588a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From 3306c49d19dd7fd646206ee0ef868e2ef4b03d65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                 |   2 +-
 .../patches/fortran-line-continuation.patch   | 143 ++++++++++++++++++
 srcpkgs/papi/patches/gnu_source.patch         |  12 --
 srcpkgs/papi/patches/use-after-realloc.patch  |  56 -------
 srcpkgs/papi/template                         |  34 +++--
 5 files changed, 168 insertions(+), 79 deletions(-)
 create mode 100644 srcpkgs/papi/patches/fortran-line-continuation.patch
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/fortran-line-continuation.patch b/srcpkgs/papi/patches/fortran-line-continuation.patch
new file mode 100644
index 0000000000000..770886f86930a
--- /dev/null
+++ b/srcpkgs/papi/patches/fortran-line-continuation.patch
@@ -0,0 +1,143 @@
+--- a/src/components/sysdetect/tests/query_device_simple_f.F
++++ b/src/components/sysdetect/tests/query_device_simple_f.F
+@@ -41,54 +41,54 @@
+               if (id == PAPI_DEV_TYPE_ID__CPU .and. dev_count > 0) then
+                   numas = 1
+                   do i = 0, dev_count - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str, &
+-                          ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,&
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass, &
+-                          dummy_str, ret_val)
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass, &
+-                          dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_CHAR_NAME, dummy_val, cpu_name,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_FAMILY, family, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_MODEL, model, dummy_str,
++     &                    ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_STEPPING, stepping,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT, sockets,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT, numas,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT, cores,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT, threads,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE, l1i_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE, l1d_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE, l2u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE, l3u_size,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE, l1i_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE, l1d_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE, l2u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE, l3u_line_sz,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT, l1i_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT, l1d_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT, l2u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT, l3u_line_cnt,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC, l1i_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC, l1d_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC, l2u_cache_ass,
++     &                    dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC, l3u_cache_ass,
++     &                    dummy_str, ret_val)
+ 
+                       print *, 'Vendor             : ', trim(vendor_name), '(', vendor_id, ')'
+                       print *, 'Id                 : ', i
+@@ -101,27 +101,27 @@
+                       print *, 'SMT/core           : ', threads / sockets / cores
+ 
+                       if (l1i_size > 0) then
+-                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ', &
+-                              l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
+-                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ', &
+-                              l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
++                          print *, 'L1i cache          : ', 'size/line size/lines/associativity ',
++     &                        l1i_size / 1024, l1i_line_sz, l1i_line_cnt, l1i_cache_ass
++                          print *, 'L1d cache          : ', 'size/line size/lines/associativity ',
++     &                        l1d_size / 1024, l1d_line_sz, l1d_line_cnt, l1d_cache_ass
+                       endif
+ 
+                       if (l2u_size > 0) then
+-                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ', &
+-                              l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
++                          print *, 'L2 cache           : ', 'size/line size/lines/associativity ',
++     &                        l2u_size / 1024, l2u_line_sz, l2u_line_cnt, l2u_cache_ass
+                       endif
+ 
+                       if (l3u_size > 0) then
+-                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ', &
+-                              l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
++                          print *, 'L3 cache           : ', 'size/line size/lines/associativity ',
++     &                        l3u_size / 1024, l3u_line_sz, l3u_line_cnt, l3u_cache_ass
+                       endif
+ 
+                   enddo
+ 
+                   do i = 0, numas - 1
+-                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE, &
+-                          mem_size, dummy_str, ret_val)
++                      call papif_get_dev_attr(handle, i, PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE,
++     &                    mem_size, dummy_str, ret_val)
+                   enddo
+               endif
+               call papif_enum_dev_type(modifier, handle, ret_val)
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..3663b4a0b5c15 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,41 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
-
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
+
+post_extract() {
+	rm -rf libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (4 preceding siblings ...)
  2023-09-06  0:01 ` sgn
@ 2023-09-06  1:12 ` sgn
  2023-09-30 10:31 ` sgn
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-06  1:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 46568 bytes --]

From 81d92e091be2d85c7a7796a50bf7f3b582e6664d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 56 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 102 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..71206730c0f10 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3431,7 +3431,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..b11551a610ea3
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,56 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="MIT"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+conflicts="papi<7.0.0_1"
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	conflicts="papi-devel<7.0.0_1"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 12f3fb51d0ced78b48baa20a128b7e5d9b0e9f2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 311095b4abea866b545109c31f37072b6d28588a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 115 ++++++--------
 7 files changed, 98 insertions(+), 651 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index baf111b170ec2..14c83f1ff74e4 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=11
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -32,8 +32,7 @@ ppc64*)
 	;;
 esac
 case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
+*-musl) makedepends+=" argp-standalone" ;;
 esac
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From b19b6f78680020dfb11d5fcdf15946f7663aec7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/libsde-soname.patch     | 11 ++++
 srcpkgs/papi/patches/musl.patch              | 33 ++++++++++++
 srcpkgs/papi/patches/prefixed-gfortran.patch | 22 ++++++++
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 34 ++++++++----
 7 files changed, 91 insertions(+), 79 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 create mode 100644 srcpkgs/papi/patches/libsde-soname.patch
 create mode 100644 srcpkgs/papi/patches/musl.patch
 create mode 100644 srcpkgs/papi/patches/prefixed-gfortran.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index 71206730c0f10..dfaebcd3313d2 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3430,7 +3430,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/libsde-soname.patch b/srcpkgs/papi/patches/libsde-soname.patch
new file mode 100644
index 0000000000000..ff78e759e3dfb
--- /dev/null
+++ b/srcpkgs/papi/patches/libsde-soname.patch
@@ -0,0 +1,11 @@
+--- a/src/sde_lib/Makefile
++++ b/src/sde_lib/Makefile
+@@ -14,7 +14,7 @@ SOBJS=$(patsubst %.c,%_s.o,$(wildcard *.
+ all: dynamic static
+ 
+ dynamic: $(DOBJS)
+-	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
++	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so.1 -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
+ 	rm -f *_d.o
+ 
+ static: $(SOBJS)
diff --git a/srcpkgs/papi/patches/musl.patch b/srcpkgs/papi/patches/musl.patch
new file mode 100644
index 0000000000000..ae45faf92330c
--- /dev/null
+++ b/srcpkgs/papi/patches/musl.patch
@@ -0,0 +1,33 @@
+--- a/src/components/perf_event/perf_helpers.h
++++ b/src/components/perf_event/perf_helpers.h
+@@ -40,14 +40,14 @@ sys_perf_event_open( struct perf_event_a
+ typedef uint64_t u64;
+ typedef int64_t s64;
+ 
+-typedef __u32 u32;
+-typedef __s32 s32;
++typedef uint32_t u32;
++typedef int32_t s32;
+ 
+-typedef __u16 u16;
+-typedef __s16 s16;
++typedef uint16_t u16;
++typedef int16_t s16;
+ 
+-typedef __u8  u8;
+-typedef __s8  s8;
++typedef uint8_t  u8;
++typedef int8_t  s8;
+ 
+ 
+ #ifdef __SIZEOF_INT128__
+--- a/src/components/perf_event/tests/perf_event_system_wide.c
++++ b/src/components/perf_event/tests/perf_event_system_wide.c
+@@ -14,6 +14,7 @@
+ #ifndef __USE_GNU
+ #define __USE_GNU
+ #endif
++#define _GNU_SOURCE
+ 
+ /* For sched_setaffinity() */
+ #include <sched.h>
diff --git a/srcpkgs/papi/patches/prefixed-gfortran.patch b/srcpkgs/papi/patches/prefixed-gfortran.patch
new file mode 100644
index 0000000000000..379d5e1757c9d
--- /dev/null
+++ b/srcpkgs/papi/patches/prefixed-gfortran.patch
@@ -0,0 +1,22 @@
+--- a/src/components/sde/tests/Makefile
++++ b/src/components/sde/tests/Makefile
+@@ -1,7 +1,7 @@
+ NAME=sde
+ include ../../Makefile_comp_tests.target
+ INCLUDE += -I$(datadir)/sde_lib -I..
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+ 	FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+ 	FFLAGS +=-ffree-form
+--- a/src/components/sysdetect/tests/Makefile
++++ b/src/components/sysdetect/tests/Makefile
+@@ -19,7 +19,7 @@ else
+     FTESTS =
+ endif
+ 
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+     FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+     FFLAGS +=-ffree-form
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..0549b99305b3e 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,41 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
-
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
+
+post_extract() {
+	rm -rf src/libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (5 preceding siblings ...)
  2023-09-06  1:12 ` sgn
@ 2023-09-30 10:31 ` sgn
  2023-09-30 10:32 ` sgn
  2023-09-30 10:33 ` [PR PATCH] [Merged]: " sgn
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-30 10:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 46643 bytes --]

From 9c882fd610bab151c47866b938cff8b2e5b4f1cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 56 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 102 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 14a51bd4ca9a4..c5c2d54ca8da6 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3405,7 +3405,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..b11551a610ea3
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,56 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="MIT"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+conflicts="papi<7.0.0_1"
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	conflicts="papi-devel<7.0.0_1"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From 82e44cffa0edd7110822542b71bd574fd58fd94a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From 64aac4e5147c306dca0c2a3bc8793e1cf2d18e5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 119 +++++++-------
 7 files changed, 100 insertions(+), 653 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index ba55f22b0796b..d938d96b53a9a 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=12
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -31,10 +31,9 @@ ppc64*)
 	makedepends+=" libnuma-devel"
 	;;
 esac
-case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" argp-standalone"
+fi
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
 esac
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From b00a20a8fa036c4d024610e4f55f1ae7ba682666 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/libsde-soname.patch     | 11 ++++
 srcpkgs/papi/patches/musl.patch              | 33 ++++++++++++
 srcpkgs/papi/patches/prefixed-gfortran.patch | 22 ++++++++
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 34 ++++++++----
 7 files changed, 91 insertions(+), 79 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 create mode 100644 srcpkgs/papi/patches/libsde-soname.patch
 create mode 100644 srcpkgs/papi/patches/musl.patch
 create mode 100644 srcpkgs/papi/patches/prefixed-gfortran.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index c5c2d54ca8da6..6c44fa6dce4d0 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3404,7 +3404,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/libsde-soname.patch b/srcpkgs/papi/patches/libsde-soname.patch
new file mode 100644
index 0000000000000..ff78e759e3dfb
--- /dev/null
+++ b/srcpkgs/papi/patches/libsde-soname.patch
@@ -0,0 +1,11 @@
+--- a/src/sde_lib/Makefile
++++ b/src/sde_lib/Makefile
+@@ -14,7 +14,7 @@ SOBJS=$(patsubst %.c,%_s.o,$(wildcard *.
+ all: dynamic static
+ 
+ dynamic: $(DOBJS)
+-	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
++	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so.1 -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
+ 	rm -f *_d.o
+ 
+ static: $(SOBJS)
diff --git a/srcpkgs/papi/patches/musl.patch b/srcpkgs/papi/patches/musl.patch
new file mode 100644
index 0000000000000..ae45faf92330c
--- /dev/null
+++ b/srcpkgs/papi/patches/musl.patch
@@ -0,0 +1,33 @@
+--- a/src/components/perf_event/perf_helpers.h
++++ b/src/components/perf_event/perf_helpers.h
+@@ -40,14 +40,14 @@ sys_perf_event_open( struct perf_event_a
+ typedef uint64_t u64;
+ typedef int64_t s64;
+ 
+-typedef __u32 u32;
+-typedef __s32 s32;
++typedef uint32_t u32;
++typedef int32_t s32;
+ 
+-typedef __u16 u16;
+-typedef __s16 s16;
++typedef uint16_t u16;
++typedef int16_t s16;
+ 
+-typedef __u8  u8;
+-typedef __s8  s8;
++typedef uint8_t  u8;
++typedef int8_t  s8;
+ 
+ 
+ #ifdef __SIZEOF_INT128__
+--- a/src/components/perf_event/tests/perf_event_system_wide.c
++++ b/src/components/perf_event/tests/perf_event_system_wide.c
+@@ -14,6 +14,7 @@
+ #ifndef __USE_GNU
+ #define __USE_GNU
+ #endif
++#define _GNU_SOURCE
+ 
+ /* For sched_setaffinity() */
+ #include <sched.h>
diff --git a/srcpkgs/papi/patches/prefixed-gfortran.patch b/srcpkgs/papi/patches/prefixed-gfortran.patch
new file mode 100644
index 0000000000000..379d5e1757c9d
--- /dev/null
+++ b/srcpkgs/papi/patches/prefixed-gfortran.patch
@@ -0,0 +1,22 @@
+--- a/src/components/sde/tests/Makefile
++++ b/src/components/sde/tests/Makefile
+@@ -1,7 +1,7 @@
+ NAME=sde
+ include ../../Makefile_comp_tests.target
+ INCLUDE += -I$(datadir)/sde_lib -I..
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+ 	FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+ 	FFLAGS +=-ffree-form
+--- a/src/components/sysdetect/tests/Makefile
++++ b/src/components/sysdetect/tests/Makefile
+@@ -19,7 +19,7 @@ else
+     FTESTS =
+ endif
+ 
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+     FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+     FFLAGS +=-ffree-form
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..0549b99305b3e 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,41 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
-
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
+
+post_extract() {
+	rm -rf src/libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Updated] linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (6 preceding siblings ...)
  2023-09-30 10:31 ` sgn
@ 2023-09-30 10:32 ` sgn
  2023-09-30 10:33 ` [PR PATCH] [Merged]: " sgn
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-30 10:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages linux-tools-6.5
https://github.com/void-linux/void-packages/pull/45920

linux-tools 6.5
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45920.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-linux-tools-6.5-45920.patch --]
[-- Type: text/x-diff, Size: 46643 bytes --]

From aa407693a423da185be0be6738e51204901850c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:30 +0700
Subject: [PATCH 1/4] New package: libpfm4-4.13.0

---
 common/shlibs                              |  2 +-
 srcpkgs/libpfm4-devel                      |  1 +
 srcpkgs/libpfm4/patches/build-params.patch | 43 +++++++++++++++++
 srcpkgs/libpfm4/template                   | 56 ++++++++++++++++++++++
 srcpkgs/python3-perfmon                    |  1 +
 5 files changed, 102 insertions(+), 1 deletion(-)
 create mode 120000 srcpkgs/libpfm4-devel
 create mode 100644 srcpkgs/libpfm4/patches/build-params.patch
 create mode 100644 srcpkgs/libpfm4/template
 create mode 120000 srcpkgs/python3-perfmon

diff --git a/common/shlibs b/common/shlibs
index 14a51bd4ca9a4..c5c2d54ca8da6 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3405,7 +3405,7 @@ libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
 libpapi.so.5 papi-5.6.0_1
-libpfm.so.4 papi-5.6.0_1
+libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
 libfifechan_opengl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/libpfm4-devel b/srcpkgs/libpfm4-devel
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/libpfm4-devel
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file
diff --git a/srcpkgs/libpfm4/patches/build-params.patch b/srcpkgs/libpfm4/patches/build-params.patch
new file mode 100644
index 0000000000000..646050477577b
--- /dev/null
+++ b/srcpkgs/libpfm4/patches/build-params.patch
@@ -0,0 +1,43 @@
+--- a/config.mk
++++ b/config.mk
+@@ -28,8 +28,20 @@
+ # It is included by every Makefile
+ #
+ #
+-SYS  := $(shell uname -s)
+-ARCH := $(shell uname -m)
++SYS  := Linux
++ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
++ARCH := i386
++else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
++ARCH := x86_64
++else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
++ARCH := arm
++else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
++ARCH := arm64
++else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
++ARCH := powerpc
++else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
++ARCH := mips
++endif
+ ifeq (i686,$(findstring i686,$(ARCH)))
+ override ARCH=i386
+ endif
+@@ -116,7 +128,7 @@ AGE=0
+ #
+ # Where should things (lib, headers, man) go in the end.
+ #
+-PREFIX?=/usr/local
++PREFIX?=/usr
+ LIBDIR=$(PREFIX)/lib
+ INCDIR=$(PREFIX)/include
+ MANDIR=$(PREFIX)/share/man
+@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
+ # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
+ # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
+ #
+-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
++DBG?=-g -Wall -Wextra -Wno-unused-parameter
+ 
+ ifeq ($(SYS),Darwin)
+ # older gcc-4.2 does not like -Wextra and some of our initialization code
diff --git a/srcpkgs/libpfm4/template b/srcpkgs/libpfm4/template
new file mode 100644
index 0000000000000..b11551a610ea3
--- /dev/null
+++ b/srcpkgs/libpfm4/template
@@ -0,0 +1,56 @@
+# Template file for 'libpfm4'
+pkgname=libpfm4
+version=4.13.0
+revision=1
+build_style=gnu-makefile
+build_helper=python3
+make_use_env=yes
+hostmakedepends="python3-setuptools swig"
+makedepends="python3-devel"
+short_desc="Library to program the performance monitoring events"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="MIT"
+homepage="https://perfmon2.sourceforge.net/"
+distfiles="${SOURCEFORGE_SITE}/perfmon2/libpfm-${version}.tar.gz"
+checksum=d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1
+conflicts="papi<7.0.0_1"
+
+export XBPS_TARGET_MACHINE
+
+do_build() {
+	msg_normal "Building libpfm4\n"
+	make ${makejobs} PREFIX=/usr
+	msg_normal "Building Python 3 bindings\n"
+	cd python
+	python3 setup.py build
+}
+
+do_install() {
+	make install DESTDIR=${DESTDIR} PREFIX=/usr
+	{
+		find include lib -name '*.h' -o -name '*.c' |
+			xargs grep -h Copyright
+		cat COPYING
+	} >license
+	vlicense license
+}
+
+libpfm4-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	conflicts="papi-devel<7.0.0_1"
+	pkg_install() {
+		vmove usr/share/man/man3
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+python3-perfmon_package() {
+	short_desc+=" - Python 3 bindings"
+	pkg_install() {
+		cd python
+		python3 setup.py install --prefix=/usr --root=${PKGDESTDIR}
+	}
+}
diff --git a/srcpkgs/python3-perfmon b/srcpkgs/python3-perfmon
new file mode 120000
index 0000000000000..954b4ab6aebc1
--- /dev/null
+++ b/srcpkgs/python3-perfmon
@@ -0,0 +1 @@
+libpfm4
\ No newline at end of file

From d939943f59cc522f254827dc6e7e8731349c05b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:45 +0700
Subject: [PATCH 2/4] libtraceevent: update to 1.7.3.

---
 srcpkgs/libtraceevent/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libtraceevent/template b/srcpkgs/libtraceevent/template
index bc970d52014e6..09f48b475fc8e 100644
--- a/srcpkgs/libtraceevent/template
+++ b/srcpkgs/libtraceevent/template
@@ -1,7 +1,7 @@
 # Template file for 'libtraceevent'
 pkgname=libtraceevent
-version=1.6.3
-revision=2
+version=1.7.3
+revision=1
 build_style=gnu-makefile
 make_build_args="libdir_relative=lib${XBPS_TARGET_WORDSIZE}"
 make_build_target="all doc"
@@ -14,7 +14,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-only, LGPL-2.1-only"
 homepage="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"
 distfiles="https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-${version}.tar.gz"
-checksum=031e4428586788bb835d894f7f11c54e482764063d96ead303c7f208fb59e353
+checksum=097b72e0d907f3107825fb2edf0188324bf70dc9da360f6efa68dc484ffde541
 
 do_check() {
 	make ${makejobs} test

From c51706d1f45bbd6facbc5d6e75c737b8e22b4b93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 20:25:55 +0700
Subject: [PATCH 3/4] linux-tools: update to 6.5.

---
 .../patches/binutils-add-compat-check.patch   | 103 ------------
 .../patches/binutils-disasm-compat.patch      | 102 ------------
 .../bpf_jit_disasm-binutils-2.39.patch        | 104 ------------
 .../patches/bpftool-binutils-2.39.patch       | 149 ------------------
 srcpkgs/linux-tools/patches/musl.patch        |  62 ++++++--
 .../patches/perf-binutils-2.39.patch          | 114 --------------
 srcpkgs/linux-tools/template                  | 119 +++++++-------
 7 files changed, 100 insertions(+), 653 deletions(-)
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
 delete mode 100644 srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
 delete mode 100644 srcpkgs/linux-tools/patches/perf-binutils-2.39.patch

diff --git a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch b/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
deleted file mode 100644
index e4e7ece9635e5..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-add-compat-check.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cfd59ca91467056bb2c36907b2fa67b8e1af9952 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:27 -0700
-Subject: [PATCH] tools build: Add feature test for init_disassemble_info API
- changes
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit adds a feature test to detect the new signature.  Subsequent
-commits will use it to fix the build failures.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/build/Makefile.feature                        |  1 +
- tools/build/feature/Makefile                        |  4 ++++
- tools/build/feature/test-all.c                      |  4 ++++
- tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
- 4 files changed, 22 insertions(+)
- create mode 100644 tools/build/feature/test-disassembler-init-styled.c
-
-diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
-index 888a0421d43b96..8f6578e4d3249e 100644
---- a/tools/build/Makefile.feature
-+++ b/tools/build/Makefile.feature
-@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC :=                  \
-         libaio				\
-         libzstd				\
-         disassembler-four-args		\
-+        disassembler-init-styled	\
-         file-handle
- 
- # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
-diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
-index 7c2a17e23c30ac..c3059739318a95 100644
---- a/tools/build/feature/Makefile
-+++ b/tools/build/feature/Makefile
-@@ -18,6 +18,7 @@ FILES=                                          \
-          test-libbfd.bin                        \
-          test-libbfd-buildid.bin		\
-          test-disassembler-four-args.bin        \
-+         test-disassembler-init-styled.bin	\
-          test-reallocarray.bin			\
-          test-libbfd-liberty.bin                \
-          test-libbfd-liberty-z.bin              \
-@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
- $(OUTPUT)test-disassembler-four-args.bin:
- 	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
- 
-+$(OUTPUT)test-disassembler-init-styled.bin:
-+	$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
-+
- $(OUTPUT)test-reallocarray.bin:
- 	$(BUILD)
- 
-diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
-index 5ffafb967b6e49..957c02c7b163b5 100644
---- a/tools/build/feature/test-all.c
-+++ b/tools/build/feature/test-all.c
-@@ -166,6 +166,10 @@
- # include "test-disassembler-four-args.c"
- #undef main
- 
-+#define main main_test_disassembler_init_styled
-+# include "test-disassembler-init-styled.c"
-+#undef main
-+
- #define main main_test_libzstd
- # include "test-libzstd.c"
- #undef main
-diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/build/feature/test-disassembler-init-styled.c
-new file mode 100644
-index 00000000000000..f1ce0ec3bee9d3
---- /dev/null
-+++ b/tools/build/feature/test-disassembler-init-styled.c
-@@ -0,0 +1,13 @@
-+// SPDX-License-Identifier: GPL-2.0
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+int main(void)
-+{
-+	struct disassemble_info info;
-+
-+	init_disassemble_info(&info, stdout,
-+			      NULL, NULL);
-+
-+	return 0;
-+}
diff --git a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch b/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
deleted file mode 100644
index 1a6cc0e6d97ca..0000000000000
--- a/srcpkgs/linux-tools/patches/binutils-disasm-compat.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From a45b3d6926231c3d024ea0de4f7bd967f83709ee Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:29 -0700
-Subject: tools include: add dis-asm-compat.h to handle version differences
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-This commit introduces a wrapper for init_disassemble_info(), to avoid
-spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent
-commits will use it to fix the build failures.
-
-It likely is worth adding a wrapper for disassember(), to avoid the already
-existing DISASM_FOUR_ARGS_SIGNATURE ifdefery.
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Signed-off-by: Ben Hutchings <benh@debian.org>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-4-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
- create mode 100644 tools/include/tools/dis-asm-compat.h
-
-(limited to 'tools/include/tools/dis-asm-compat.h')
-
-diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h
-new file mode 100644
-index 0000000000000..70f331e23ed3d
---- /dev/null
-+++ b/tools/include/tools/dis-asm-compat.h
-@@ -0,0 +1,55 @@
-+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
-+#ifndef _TOOLS_DIS_ASM_COMPAT_H
-+#define _TOOLS_DIS_ASM_COMPAT_H
-+
-+#include <stdio.h>
-+#include <dis-asm.h>
-+
-+/* define types for older binutils version, to centralize ifdef'ery a bit */
-+#ifndef DISASM_INIT_STYLED
-+enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY};
-+typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...);
-+#endif
-+
-+/*
-+ * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to
-+ * init_disassemble_info_compat() when normal fprintf suffices.
-+ */
-+static inline int fprintf_styled(void *out,
-+				 enum disassembler_style style,
-+				 const char *fmt, ...)
-+{
-+	va_list args;
-+	int r;
-+
-+	(void)style;
-+
-+	va_start(args, fmt);
-+	r = vfprintf(out, fmt, args);
-+	va_end(args);
-+
-+	return r;
-+}
-+
-+/*
-+ * Wrapper for init_disassemble_info() that hides version
-+ * differences. Depending on binutils version and architecture either
-+ * fprintf_func or fprintf_styled_func will be called.
-+ */
-+static inline void init_disassemble_info_compat(struct disassemble_info *info,
-+						void *stream,
-+						fprintf_ftype unstyled_func,
-+						fprintf_styled_ftype styled_func)
-+{
-+#ifdef DISASM_INIT_STYLED
-+	init_disassemble_info(info, stream,
-+			      unstyled_func,
-+			      styled_func);
-+#else
-+	(void)styled_func;
-+	init_disassemble_info(info, stream,
-+			      unstyled_func);
-+#endif
-+}
-+
-+#endif /* _TOOLS_DIS_ASM_COMPAT_H */
--- 
-cgit 
-
diff --git a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
deleted file mode 100644
index 01221fad3a4a6..0000000000000
--- a/srcpkgs/linux-tools/patches/bpf_jit_disasm-binutils-2.39.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 96ed066054abf11c7d3e106e3011a51f3f1227a3 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:31 -0700
-Subject: [PATCH] tools bpf_jit_disasm: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpf_jit_disasm can still disassemble bpf programs, both
-with the old and new dis-asm.h API. With old binutils there's no change in
-output before/after this patch. When comparing the output from old
-binutils (2.35) to new bintuils with the patch (upstream snapshot) there
-are a few output differences, but they are unrelated to this patch. An
-example hunk is:
-
-     f4:	mov    %r14,%rsi
-     f7:	mov    %r15,%rdx
-     fa:	mov    $0x2a,%ecx
-  -  ff:	callq  0xffffffffea8c4988
-  +  ff:	call   0xffffffffea8c4988
-    104:	test   %rax,%rax
-    107:	jge    0x0000000000000110
-    109:	xor    %eax,%eax
-  - 10b:	jmpq   0x0000000000000073
-  + 10b:	jmp    0x0000000000000073
-    110:	cmp    $0x16,%rax
-
-However, I had to use an older kernel to generate the bpf_jit_enabled =
-2 output, as that has been broken since 5.18 / 1022a5498f6f745c ("bpf,
-x86_64: Use bpf_jit_binary_pack_alloc").
-
-  https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-6-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/Makefile         | 5 ++++-
- tools/bpf/bpf_jit_disasm.c | 5 ++++-
- 2 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
-index b11cfc86a3d021..664601ab1705ab 100644
---- a/tools/bpf/Makefile
-+++ b/tools/bpf/Makefile
-@@ -34,7 +34,7 @@ else
- endif
- 
- FEATURE_USER = .bpf
--FEATURE_TESTS = libbfd disassembler-four-args
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled
- FEATURE_DISPLAY = libbfd disassembler-four-args
- 
- check_feat := 1
-@@ -56,6 +56,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
- 	$(QUIET_BISON)$(YACC) -o $@ -d $<
-diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
-index c8ae9580472814..a90a5d110f9255 100644
---- a/tools/bpf/bpf_jit_disasm.c
-+++ b/tools/bpf/bpf_jit_disasm.c
-@@ -28,6 +28,7 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <limits.h>
-+#include <tools/dis-asm-compat.h>
- 
- #define CMD_ACTION_SIZE_BUFFER		10
- #define CMD_ACTION_READ_ALL		3
-@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
- 	assert(bfdf);
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
--	init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
-+	init_disassemble_info_compat(&info, stdout,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 	info.buffer = image;
diff --git a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch b/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
deleted file mode 100644
index 1e55c40011be7..0000000000000
--- a/srcpkgs/linux-tools/patches/bpftool-binutils-2.39.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From 600b7b26c07a070d0153daa76b3806c1e52c9e00 Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:33 -0700
-Subject: [PATCH] tools bpftool: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that bpftool can still disassemble bpf programs, both with an
-old and new dis-asm.h API. There are no output changes for plain and json
-formats. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-     2f:	pop    %r14
-     31:	pop    %r13
-     33:	pop    %rbx
-  -  34:	leaveq
-  -  35:	retq
-  +  34:	leave
-  +  35:	ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Quentin Monnet <quentin@isovalent.com>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-8-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/bpf/bpftool/Makefile     |  5 +++-
- tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++-------
- 2 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
-index c6d2c77d02524a..436e671b2657d4 100644
---- a/tools/bpf/bpftool/Makefile
-+++ b/tools/bpf/bpftool/Makefile
-@@ -62,7 +62,7 @@ CLANG ?= clang
- LLVM_STRIP ?= llvm-strip
- 
- FEATURE_USER = .bpftool
--FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
-+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled reallocarray zlib libcap \
- 	clang-bpf-co-re
- FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \
- 	clang-bpf-co-re
-@@ -117,6 +117,9 @@ endif
- ifeq ($(feature-disassembler-four-args), 1)
- CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
- 
- LIBS = $(LIBBPF) -lelf -lz
- LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
-diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
-index 24734f2249d6ec..aaf99a0168c90b 100644
---- a/tools/bpf/bpftool/jit_disasm.c
-+++ b/tools/bpf/bpftool/jit_disasm.c
-@@ -24,6 +24,7 @@
- #include <sys/stat.h>
- #include <limits.h>
- #include <bpf/libbpf.h>
-+#include <tools/dis-asm-compat.h>
- 
- #include "json_writer.h"
- #include "main.h"
-@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, s
- }
- 
- static int oper_count;
--static int fprintf_json(void *out, const char *fmt, ...)
-+static int printf_json(void *out, const char *fmt, va_list ap)
- {
--	va_list ap;
- 	char *s;
- 
--	va_start(ap, fmt);
- 	if (vasprintf(&s, fmt, ap) < 0)
- 		return -1;
--	va_end(ap);
- 
- 	if (!oper_count) {
- 		int i;
-@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...)
- 	return 0;
- }
- 
-+static int fprintf_json(void *out, const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
-+static int fprintf_json_styled(void *out,
-+			       enum disassembler_style style __maybe_unused,
-+			       const char *fmt, ...)
-+{
-+	va_list ap;
-+	int r;
-+
-+	va_start(ap, fmt);
-+	r = printf_json(out, fmt, ap);
-+	va_end(ap);
-+
-+	return r;
-+}
-+
- void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 		       const char *arch, const char *disassembler_options,
- 		       const struct btf *btf,
-@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
- 	assert(bfd_check_format(bfdf, bfd_object));
- 
- 	if (json_output)
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf_json);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf_json,
-+					     fprintf_json_styled);
- 	else
--		init_disassemble_info(&info, stdout,
--				      (fprintf_ftype) fprintf);
-+		init_disassemble_info_compat(&info, stdout,
-+					     (fprintf_ftype) fprintf,
-+					     fprintf_styled);
- 
- 	/* Update architecture info for offload. */
- 	if (arch) {
diff --git a/srcpkgs/linux-tools/patches/musl.patch b/srcpkgs/linux-tools/patches/musl.patch
index 57ca91cae26c0..bff29b39e04d1 100644
--- a/srcpkgs/linux-tools/patches/musl.patch
+++ b/srcpkgs/linux-tools/patches/musl.patch
@@ -1,6 +1,6 @@
 --- a/tools/include/uapi/linux/perf_event.h
 +++ b/tools/include/uapi/linux/perf_event.h
-@@ -14,6 +14,7 @@
+@@ -15,6 +15,7 @@
  #ifndef _UAPI_LINUX_PERF_EVENT_H
  #define _UAPI_LINUX_PERF_EVENT_H
  
@@ -10,24 +10,54 @@
  #include <asm/byteorder.h>
 --- a/tools/power/x86/turbostat/turbostat.c
 +++ b/tools/power/x86/turbostat/turbostat.c
-@@ -43,7 +43,8 @@
- #include <cpuid.h>
- #include <linux/capability.h>
+@@ -33,6 +33,7 @@
+ #include <sys/capability.h>
  #include <errno.h>
  #include <math.h>
 +#include <limits.h>
+ #include <linux/perf_event.h>
+ #include <asm/unistd.h>
+ #include <stdbool.h>
+--- a/tools/bpf/bpf_jit_disasm.c
++++ b/tools/bpf/bpf_jit_disasm.c
+@@ -306,7 +306,7 @@ int main(int argc, char **argv)
+ 		goto done;
+ 	}
  
- char *proc_stat = "/proc/stat";
- FILE *outf;
---- a/tools/thermal/tmon/tmon.h
-+++ b/tools/thermal/tmon/tmon.h
-@@ -19,6 +19,9 @@
- #ifndef TMON_H
- #define TMON_H
+-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
++	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ 	if (ofd < 0) {
+ 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
+ 		perror(NULL);
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -2,9 +2,15 @@
+ /* Copyright (c) 2018 Facebook */
  
-+#include <pthread.h>
-+#include <sys/time.h>
+ #include <ctype.h>
++#include <stdbool.h>
+ #include <stdio.h> /* for (FILE *) used by json_writer */
+ #include <string.h>
+ #include <unistd.h>
 +
- #define MAX_DISP_TEMP 125
- #define MAX_CTRL_TEMP 105
- #define MIN_CTRL_TEMP 40
++#ifndef __always_inline
++#define __always_inline inline __attribute__((always_inline))
++#endif
++
+ #include <asm/byteorder.h>
+ #include <linux/bitops.h>
+ #include <linux/btf.h>
+--- a/tools/include/linux/err.h
++++ b/tools/include/linux/err.h
+@@ -6,6 +6,11 @@
+ #include <linux/types.h>
+ 
+ #include <asm/errno.h>
++#include <stdbool.h>
++
++#ifndef __must_check
++#define __must_check __attribute__((warn_unused_result))
++#endif
+ 
+ /*
+  * Original kernel header comment:
diff --git a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch b/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
deleted file mode 100644
index 3484330f7286a..0000000000000
--- a/srcpkgs/linux-tools/patches/perf-binutils-2.39.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 83aa0120487e8bc3f231e72c460add783f71f17c Mon Sep 17 00:00:00 2001
-From: Andres Freund <andres@anarazel.de>
-Date: Sun, 31 Jul 2022 18:38:30 -0700
-Subject: [PATCH] tools perf: Fix compilation error with new binutils
-
-binutils changed the signature of init_disassemble_info(), which now causes
-compilation failures for tools/perf/util/annotate.c, e.g. on debian
-unstable.
-
-Relevant binutils commit:
-
-  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
-
-Wire up the feature test and switch to init_disassemble_info_compat(),
-which were introduced in prior commits, fixing the compilation failure.
-
-I verified that perf can still disassemble bpf programs by using bpftrace
-under load, recording a perf trace, and then annotating the bpf "function"
-with and without the changes. With old binutils there's no change in output
-before/after this patch. When comparing the output from old binutils (2.35)
-to new bintuils with the patch (upstream snapshot) there are a few output
-differences, but they are unrelated to this patch. An example hunk is:
-
-       1.15 :   55:mov    %rbp,%rdx
-       0.00 :   58:add    $0xfffffffffffffff8,%rdx
-       0.00 :   5c:xor    %ecx,%ecx
-  -    1.03 :   5e:callq  0xffffffffe12aca3c
-  +    1.03 :   5e:call   0xffffffffe12aca3c
-       0.00 :   63:xor    %eax,%eax
-  -    2.18 :   65:leaveq
-  -    2.82 :   66:retq
-  +    2.18 :   65:leave
-  +    2.82 :   66:ret
-
-Signed-off-by: Andres Freund <andres@anarazel.de>
-Acked-by: Quentin Monnet <quentin@isovalent.com>
-Cc: Alexei Starovoitov <ast@kernel.org>
-Cc: Ben Hutchings <benh@debian.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Sedat Dilek <sedat.dilek@gmail.com>
-Cc: bpf@vger.kernel.org
-Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
-Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----
- tools/perf/Makefile.config | 8 ++++++++
- tools/perf/util/annotate.c | 7 ++++---
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
-index d3c254c0f5c611..23648ea54e8d3d 100644
---- a/tools/perf/Makefile.config
-+++ b/tools/perf/Makefile.config
-@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_LDFLAGS-libaio = -lrt
- 
- FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
-+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl
- 
- CORE_CFLAGS += -fno-omit-frame-pointer
- CORE_CFLAGS += -ggdb3
-@@ -818,13 +819,16 @@ else
-   ifeq ($(feature-libbfd-liberty), 1)
-     EXTLIBS += -lbfd -lopcodes -liberty
-     FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
-+    FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl
-   else
-     ifeq ($(feature-libbfd-liberty-z), 1)
-       EXTLIBS += -lbfd -lopcodes -liberty -lz
-       FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
-+      FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl
-     endif
-   endif
-   $(call feature_check,disassembler-four-args)
-+  $(call feature_check,disassembler-init-styled)
- endif
- 
- ifeq ($(feature-libbfd-buildid), 1)
-@@ -1044,6 +1048,10 @@ ifeq ($(feature-disassembler-four-args), 1)
-     CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
- endif
- 
-+ifeq ($(feature-disassembler-init-styled), 1)
-+    CFLAGS += -DDISASM_INIT_STYLED
-+endif
-+
- ifeq (${IS_64_BIT}, 1)
-   ifndef NO_PERF_READ_VDSO32
-     $(call feature_check,compile-32)
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 82cc396ef516c4..2c6a485c3de5d9 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -1676,6 +1676,7 @@ fallback:
- #define PACKAGE "perf"
- #include <bfd.h>
- #include <dis-asm.h>
-+#include <tools/dis-asm-compat.h>
- 
- static int symbol__disassemble_bpf(struct symbol *sym,
- 				   struct annotate_args *args)
-@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym,
- 		ret = errno;
- 		goto out;
- 	}
--	init_disassemble_info(&info, s,
--			      (fprintf_ftype) fprintf);
--
-+	init_disassemble_info_compat(&info, s,
-+				     (fprintf_ftype) fprintf,
-+				     fprintf_styled);
- 	info.arch = bfd_get_arch(bfdf);
- 	info.mach = bfd_get_mach(bfdf);
- 
diff --git a/srcpkgs/linux-tools/template b/srcpkgs/linux-tools/template
index ba55f22b0796b..d938d96b53a9a 100644
--- a/srcpkgs/linux-tools/template
+++ b/srcpkgs/linux-tools/template
@@ -1,26 +1,26 @@
 # Template file for 'linux-tools'
 pkgname=linux-tools
-version=5.10.4
-revision=12
+version=6.5
+revision=1
 build_style=meta
 hostmakedepends="asciidoc automake flex gettext libtool perl python3
- python3-docutils xmlto"
+ python3-docutils xmlto pkg-config"
 makedepends="babeltrace-devel binutils-devel elfutils-devel eudev-libudev-devel
  libcap-devel liblzma-devel openssl-devel libsysfs-devel libunwind-devel
  libzstd-devel ncurses-devel pciutils-devel python3-devel readline-devel
- slang-devel libaudit-devel"
+ slang-devel libaudit-devel libtraceevent-devel libpfm4-devel"
 depends="cpupower-${version}_${revision} perf-${version}_${revision} usbip-${version}_${revision}"
 short_desc="Linux kernel tools meta-pkg"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="GPL-2.0-only"
 homepage="https://www.kernel.org"
-distfiles="${KERNEL_SITE}/kernel/v5.x/linux-${version}.tar.xz"
-checksum=904e396c26e9992a16cd1cc989460171536bed7739bf36049f6eb020ee5d56ec
+distfiles="${KERNEL_SITE}/kernel/v${version%%.*}.x/linux-${version}.tar.xz"
+checksum=7a574bbc20802ea76b52ca7faf07267f72045e861b18915c5272a98c27abf884
 python_version=3
 
-subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip"
+subpackages="cpupower freefall libcpupower libcpupower-devel libusbip libusbip-devel perf tmon usbip bpftool"
 
-CFLAGS="-Wno-error -fcommon"
+CFLAGS="-Wno-error"
 case "$XBPS_TARGET_MACHINE" in
 i686*|x86_64*)
 	makedepends+=" libnuma-devel"
@@ -31,10 +31,9 @@ ppc64*)
 	makedepends+=" libnuma-devel"
 	;;
 esac
-case "$XBPS_TARGET_MACHINE" in
-*-musl) ;;
-*)	subpackages+=" bpftool";;  # needs FTW_ACTIONRETVAL
-esac
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" argp-standalone"
+fi
 case "$XBPS_TARGET_MACHINE" in
 i686-musl) makedepends+=" libunwind-devel" ;;
 esac
@@ -51,15 +50,15 @@ pre_configure() {
 }
 
 do_build() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
@@ -71,7 +70,7 @@ do_build() {
 
 	make -C tools/perf ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
+		WERROR=0 prefix=/usr lib=lib/perf \
 		NO_GTK2=1 NO_SDT=1 PYTHON=python3 \
 		all man
 
@@ -102,68 +101,44 @@ do_build() {
 	make -C tools/thermal/tmon ${makejobs} V=1 ARCH=$arch \
 		CC=$CC LD=$LD CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		make -C tools/bpf/bpftool ARCH=$arch all doc
-		make -C tools/bpf/bpftool ARCH=$arch -W runqslower
-	esac
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch all doc
+	make -C tools/bpf/bpftool ${makejobs} ARCH=$arch -W runqslower
+	make -C tools/bpf ${makejobs} ARCH=$arch all -W runqslower
 }
 
 do_install() {
-	local arch subarch
+	local arch
 	case "$XBPS_TARGET_MACHINE" in
 		i686*) arch=i386;;
 		x86_64*) arch=x86_64;;
 		arm*) arch=arm;;
 		aarch64*) arch=arm64;;
-		ppc64le*) arch=powerpc; subarch=ppc64le;;
-		ppc64*) arch=powerpc; subarch=ppc64;;
-		ppc*) arch=powerpc; subarch=ppc;;
+		ppc64le*) arch=powerpc;;
+		ppc64*) arch=powerpc;;
+		ppc*) arch=powerpc;;
 		mips*) arch=mips;;
 	esac
 
 	# cpupower
-	cd ${wrksrc}/tools/power/cpupower
-	make DESTDIR=${DESTDIR} ARCH=$arch \
+	make -C tools/power/cpupower DESTDIR=${DESTDIR} ARCH=$arch \
 		sbindir='/usr/bin' \
 		mandir='/usr/share/man' \
 		docdir='/usr/share/doc/cpupower' \
 		install install-man
 
-	# freefall
-	vbin "${wrksrc}/tools/laptop/freefall/freefall"
-
-	# perf
-	cd ${wrksrc}/tools/perf
-	make CC=$CC LD=$LD CFLAGS="$CFLAGS" EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-		WERROR=0 DESTDIR=${DESTDIR} prefix=/usr lib=lib/perf \
-		NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
-		install install-man
-	# move completion in new directory
-	vmkdir usr/share/bash-completion/completions
-	mv ${DESTDIR}/etc/bash_completion.d/perf \
-		${DESTDIR}/usr/share/bash-completion/completions
-
 	# usbip
-	cd ${wrksrc}/tools/usb/usbip
-	make install ARCH=$arch DESTDIR=${DESTDIR}
+	make -C tools/usb/usbip install ARCH=$arch DESTDIR=${DESTDIR}
 	vmkdir usr/lib/modules-load.d
 	printf '%s\n' usbip-core usbip-host \
 		>${DESTDIR}/usr/lib/modules-load.d/usbip.conf
 
 	# bpf
-	case "$XBPS_TARGET_MACHINE" in
-	*-musl) ;;
-	*)
-		cd ${wrksrc}/tools/bpf
-		make -W runqslower_install install \
-			DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
-		make -C bpftool doc-install \
-			DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
-		rm ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
-		mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
-	esac
+	make -C tools/bpf install \
+		DESTDIR=${DESTDIR} prefix=/usr ARCH=$arch
+	make -C tools/bpf/bpftool doc-install \
+		DESTDIR=${DESTDIR} prefix=/usr/share ARCH=$arch
+	rm -f ${DESTDIR}/usr/share/man/man7/bpf-helpers.7
+	mv ${DESTDIR}/usr/sbin/* ${DESTDIR}/usr/bin
 
 	rm ${DESTDIR}/usr/include/cpuidle.h
 }
@@ -199,6 +174,7 @@ libcpupower-devel_package() {
 	depends="libcpupower-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/cpufreq.h
+		vmove usr/include/powercap.h
 		vmove usr/lib/libcpupower.so
 	}
 }
@@ -220,14 +196,27 @@ libusbip-devel_package() {
 perf_package() {
 	short_desc="Linux kernel performance auditing tool"
 	pkg_install() {
-		vmove usr/bin/perf
-		vmove usr/bin/trace
-		vmove usr/lib/perf
-		vmove usr/libexec/perf-core
-		vmove usr/share/bash-completion/completions/perf
-		vmove usr/share/perf-core
-		vmove /usr/share/doc/perf-tip
-		vmove "usr/share/man/man1/perf*"
+		local arch
+		case "$XBPS_TARGET_MACHINE" in
+			i686*) arch=i386;;
+			x86_64*) arch=x86_64;;
+			arm*) arch=arm;;
+			aarch64*) arch=arm64;;
+			ppc64le*) arch=powerpc;;
+			ppc64*) arch=powerpc;;
+			ppc*) arch=powerpc;;
+			mips*) arch=mips;;
+		esac
+		make -C tools/perf \
+			CC=$CC LD=$LD CFLAGS="$CFLAGS" \
+			EXTRA_CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
+			WERROR=0 DESTDIR=${PKGDESTDIR} prefix=/usr lib=lib/perf \
+			NO_GTK2=1 NO_SDT=1 PYTHON=python3 ARCH=$arch \
+			install install-man
+		# move completion in new directory
+		vmkdir usr/share/bash-completion/completions
+		mv ${PKGDESTDIR}/etc/bash_completion.d/perf \
+			${PKGDESTDIR}/usr/share/bash-completion/completions
 	}
 }
 x86_energy_perf_policy_package() {
@@ -250,7 +239,7 @@ usbip_package() {
 freefall_package() {
 	short_desc="Disk protection for HP/DELL machines"
 	pkg_install() {
-		vmove usr/bin/freefall
+		vbin "${wrksrc}/tools/laptop/freefall/freefall"
 		vsv freefall
 	}
 }

From 8d0aff0c00810ef6b4954b5f44d7eb361e1cac9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 5 Sep 2023 21:20:51 +0700
Subject: [PATCH 4/4] papi: update to 7.0.1.

---
 common/shlibs                                |  2 +-
 srcpkgs/papi/patches/gnu_source.patch        | 12 -----
 srcpkgs/papi/patches/libsde-soname.patch     | 11 ++++
 srcpkgs/papi/patches/musl.patch              | 33 ++++++++++++
 srcpkgs/papi/patches/prefixed-gfortran.patch | 22 ++++++++
 srcpkgs/papi/patches/use-after-realloc.patch | 56 --------------------
 srcpkgs/papi/template                        | 34 ++++++++----
 7 files changed, 91 insertions(+), 79 deletions(-)
 delete mode 100644 srcpkgs/papi/patches/gnu_source.patch
 create mode 100644 srcpkgs/papi/patches/libsde-soname.patch
 create mode 100644 srcpkgs/papi/patches/musl.patch
 create mode 100644 srcpkgs/papi/patches/prefixed-gfortran.patch
 delete mode 100644 srcpkgs/papi/patches/use-after-realloc.patch

diff --git a/common/shlibs b/common/shlibs
index c5c2d54ca8da6..6c44fa6dce4d0 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3404,7 +3404,7 @@ libmed.so.11 libmed-4.0.0_1
 libeog.so eog-3.28.0_4
 libfreexl.so.1 freexl-1.0.5_1
 libgeos_c.so.1 geos-3.9.0_1
-libpapi.so.5 papi-5.6.0_1
+libpapi.so.7 papi-7.0.1_1
 libpfm.so.4 libpfm4-4.13.0_1
 libfifechan.so.0.1.5 fifechan-0.1.5_1
 libfifechan_sdl.so.0.1.5 fifechan-0.1.5_1
diff --git a/srcpkgs/papi/patches/gnu_source.patch b/srcpkgs/papi/patches/gnu_source.patch
deleted file mode 100644
index cc80e0ee643d9..0000000000000
--- a/srcpkgs/papi/patches/gnu_source.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:48:40.217216625 +0200
-+++ b/src/components/perf_event/tests/perf_event_system_wide.c	2019-10-12 17:49:48.246645644 +0200
-@@ -15,6 +15,9 @@
- #define __USE_GNU
- #endif
- 
-+/* For cpu_set_t */
-+#define _GNU_SOURCE
-+
- /* For sched_setaffinity() */
- #include <sched.h>
- 
diff --git a/srcpkgs/papi/patches/libsde-soname.patch b/srcpkgs/papi/patches/libsde-soname.patch
new file mode 100644
index 0000000000000..ff78e759e3dfb
--- /dev/null
+++ b/srcpkgs/papi/patches/libsde-soname.patch
@@ -0,0 +1,11 @@
+--- a/src/sde_lib/Makefile
++++ b/src/sde_lib/Makefile
+@@ -14,7 +14,7 @@ SOBJS=$(patsubst %.c,%_s.o,$(wildcard *.
+ all: dynamic static
+ 
+ dynamic: $(DOBJS)
+-	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
++	$(CC) -Bdynamic -fPIC -shared -Wl,-soname -Wl,libsde.so.1 -fvisibility=hidden -Wextra -Wall -g -O2 $(DOBJS) -lrt -ldl -pthread -o libsde.so.1.0
+ 	rm -f *_d.o
+ 
+ static: $(SOBJS)
diff --git a/srcpkgs/papi/patches/musl.patch b/srcpkgs/papi/patches/musl.patch
new file mode 100644
index 0000000000000..ae45faf92330c
--- /dev/null
+++ b/srcpkgs/papi/patches/musl.patch
@@ -0,0 +1,33 @@
+--- a/src/components/perf_event/perf_helpers.h
++++ b/src/components/perf_event/perf_helpers.h
+@@ -40,14 +40,14 @@ sys_perf_event_open( struct perf_event_a
+ typedef uint64_t u64;
+ typedef int64_t s64;
+ 
+-typedef __u32 u32;
+-typedef __s32 s32;
++typedef uint32_t u32;
++typedef int32_t s32;
+ 
+-typedef __u16 u16;
+-typedef __s16 s16;
++typedef uint16_t u16;
++typedef int16_t s16;
+ 
+-typedef __u8  u8;
+-typedef __s8  s8;
++typedef uint8_t  u8;
++typedef int8_t  s8;
+ 
+ 
+ #ifdef __SIZEOF_INT128__
+--- a/src/components/perf_event/tests/perf_event_system_wide.c
++++ b/src/components/perf_event/tests/perf_event_system_wide.c
+@@ -14,6 +14,7 @@
+ #ifndef __USE_GNU
+ #define __USE_GNU
+ #endif
++#define _GNU_SOURCE
+ 
+ /* For sched_setaffinity() */
+ #include <sched.h>
diff --git a/srcpkgs/papi/patches/prefixed-gfortran.patch b/srcpkgs/papi/patches/prefixed-gfortran.patch
new file mode 100644
index 0000000000000..379d5e1757c9d
--- /dev/null
+++ b/srcpkgs/papi/patches/prefixed-gfortran.patch
@@ -0,0 +1,22 @@
+--- a/src/components/sde/tests/Makefile
++++ b/src/components/sde/tests/Makefile
+@@ -1,7 +1,7 @@
+ NAME=sde
+ include ../../Makefile_comp_tests.target
+ INCLUDE += -I$(datadir)/sde_lib -I..
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+ 	FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+ 	FFLAGS +=-ffree-form
+--- a/src/components/sysdetect/tests/Makefile
++++ b/src/components/sysdetect/tests/Makefile
+@@ -19,7 +19,7 @@ else
+     FTESTS =
+ endif
+ 
+-ifeq ($(notdir $(F77)),gfortran)
++ifeq ($(findstring gfortran,$(notdir $(F77))),gfortran)
+     FFLAGS +=-ffree-form -ffree-line-length-none
+ else ifeq ($(notdir $(F77)),flang)
+     FFLAGS +=-ffree-form
diff --git a/srcpkgs/papi/patches/use-after-realloc.patch b/srcpkgs/papi/patches/use-after-realloc.patch
deleted file mode 100644
index 27c88d361918a..0000000000000
--- a/srcpkgs/papi/patches/use-after-realloc.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Index: papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-===================================================================
---- papi-5.7.0.orig/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-+++ papi-5.7.0/src/libpfm4/lib/pfmlib_perf_event_pmu.c
-@@ -23,6 +23,7 @@
-  */
- #include <sys/types.h>
- #include <string.h>
-+#include <stddef.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <unistd.h>
-@@ -254,6 +255,7 @@ static perf_event_t *
- perf_table_alloc_event(void)
- {
- 	perf_event_t *new_pe;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_pe_free < perf_pe_end)
-@@ -261,11 +263,12 @@ retry:
- 
- 	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
- 	
-+	offset = perf_pe_free - perf_pe;
- 	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
- 	if (!new_pe) 
- 		return NULL;
- 	
--	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
-+	perf_pe_free = new_pe + offset;
- 	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
- 	perf_pe = new_pe;
- 
-@@ -290,6 +293,7 @@ static perf_umask_t *
- perf_table_alloc_umask(void)
- {
- 	perf_umask_t *new_um;
-+	ptrdiff_t offset;
- 
- retry:
- 	if (perf_um_free < perf_um_end)
-@@ -297,11 +301,12 @@ retry:
- 
- 	perf_um_count += PERF_ALLOC_UMASK_COUNT;
- 	
-+	offset = perf_um_free  - perf_um;
- 	new_um = realloc(perf_um, perf_um_count * sizeof(*new_um));
- 	if (!new_um) 
- 		return NULL;
- 	
--	perf_um_free = new_um + (perf_um_free - perf_um);
-+	perf_um_free = new_um + offset;
- 	perf_um_end = perf_um_free + PERF_ALLOC_UMASK_COUNT;
- 	perf_um = new_um;
- 
diff --git a/srcpkgs/papi/template b/srcpkgs/papi/template
index b343a6e363739..0549b99305b3e 100644
--- a/srcpkgs/papi/template
+++ b/srcpkgs/papi/template
@@ -1,27 +1,41 @@
 # Template file for 'papi'
 pkgname=papi
-version=5.7.0
+version=7.0.1
 revision=1
 build_wrksrc="src"
 build_style=gnu-configure
+configure_args="--with-pfm-root=$XBPS_CROSS_BASE/usr --with-tls=__thread
+ --with-ffsll --with-virtualtimer=cloc_thread_cputime_id
+ --with-walltimer=clock_realtime --with-arch=${XBPS_TARGET_MACHINE%-musl}"
+hostmakedepends="gcc-fortran openmpi"
+makedepends="libpfm4-devel libgomp-devel openmpi-devel"
 short_desc="Provides interface for use of performance counter hardware"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause"
-homepage="http://icl.cs.utk.edu/papi/"
+homepage="https://icl.utk.edu/papi/"
 distfiles="http://icl.utk.edu/projects/papi/downloads/papi-${version}.tar.gz"
-checksum=d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589
-
-if [ -n "$CROSS_BUILD" ]; then
-	_ARCH="${XBPS_TARGET_MACHINE%-musl}"
-	configure_args+=" --with-ffsll --with-tls
- --with-walltimer=clock_realtime --with-virtualtimer=cloc_thread_cputime_id
- --with-CPU=${_ARCH} --with-arch=${_ARCH}"
-fi
+checksum=c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e
+python_version=3
 
 case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*) configure_args+=" --with-CPU=x86" ;;
+	arm*|aarch*) configure_args+=" --with-CPU=arm" ;;
 	ppc*-musl) broken="requires non-standard __ppc_get_timebase_freq";;
+	ppc64le*) configure_args+=" --with-CPU=POWER8" ;;
+	ppc64*) configure_args+=" --with-CPU=PPC970" ;;
+	ppc*) configure_args+=" --with-CPU=ppc" ;;
+	mips*) configure_args+=" --with-CPU=mips" ;;
 esac
 
+pre_build() {
+	export OMPI_CC="$CC"
+	export OMPI_FC="$FC"
+}
+
+post_extract() {
+	rm -rf src/libpfm*
+}
+
 post_install() {
 	vlicense ../LICENSE.txt
 }

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

* Re: [PR PATCH] [Merged]: linux-tools 6.5
  2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
                   ` (7 preceding siblings ...)
  2023-09-30 10:32 ` sgn
@ 2023-09-30 10:33 ` sgn
  8 siblings, 0 replies; 10+ messages in thread
From: sgn @ 2023-09-30 10:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

There's a merged pull request on the void-packages repository

linux-tools 6.5
https://github.com/void-linux/void-packages/pull/45920

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


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

end of thread, other threads:[~2023-09-30 10:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 13:29 [PR PATCH] linux-tools 6.5 sgn
2023-09-05 14:21 ` [PR PATCH] [Updated] " sgn
2023-09-05 15:14 ` sgn
2023-09-05 15:17 ` sgn
2023-09-05 23:58 ` sgn
2023-09-06  0:01 ` sgn
2023-09-06  1:12 ` sgn
2023-09-30 10:31 ` sgn
2023-09-30 10:32 ` sgn
2023-09-30 10:33 ` [PR PATCH] [Merged]: " sgn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).