diff --git a/bpf_perf_event_arm64.h b/bpf_perf_event_arm64.h new file mode 100644 index 0000000..5e1e648 --- /dev/null +++ b/bpf_perf_event_arm64.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ +#define _UAPI__ASM_BPF_PERF_EVENT_H__ + +#include + +typedef struct user_pt_regs bpf_user_pt_regs_t; + +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ diff --git a/perf.spec b/perf.spec index 0a52beb..cae7726 100644 --- a/perf.spec +++ b/perf.spec @@ -6,6 +6,9 @@ %bcond_without manpages +# requires missing header to be patched in +%bcond_without libbpf + %if 0%{?facebook} %bcond_with perl %else @@ -20,6 +23,7 @@ Summary: Performance monitoring for the Linux kernel License: GPL-2.0-only URL: https://perf.wiki.kernel.org/ Source: https://mirrors.edge.kernel.org/pub/linux/kernel/tools/perf/v%{version}/perf-%{version}.tar.xz +Source1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/arm64/include/uapi/asm/bpf_perf_event.h?h=v6.9#/bpf_perf_event_arm64.h BuildRequires: make BuildRequires: bison @@ -86,9 +90,24 @@ The python3-perf package contains a module that permits applications written in the Python programming language to use the interface to manipulate perf events. +# technically Makefile.config checks for lib64 but it seems to not work +# ifeq ($(SRCARCH)$(IS_64_BIT), x861) +%global perf_flags VF=1 prefix=%{_prefix} lib=%{_lib} +%if %{without libbpf} +%global perf_flags %perf_flags NO_LIBBPF=1 +%endif +%global perf_make %make_build %{perf_flags} +%global perf_make_install %make_install %{perf_flags} + %prep -%autosetup +%autosetup -p1 +%if %{with libbpf} +# copy in missing files +UAPI_ASM_ARM_DIR=arch/arm64/include/uapi/asm +mkdir -p $UAPI_ASM_ARM_DIR +cp -p %{SOURCE1} $UAPI_ASM_ARM_DIR/bpf_perf_event.h +%endif %build @@ -98,24 +117,20 @@ unset LDFLAGS # /usr/bin/ld: perf-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE #global optflags %{optflags} -fPIE -%make_build -C tools/perf +%perf_make -C tools/perf + +%perf_make -C tools/lib/perf -%make_build -C tools/lib/perf %install unset CXXFLAGS unset LDFLAGS -%make_install -C tools/perf \ - prefix=%{_prefix} - -%make_install -C tools/lib/perf \ - prefix=%{_prefix} +%perf_make_install -C tools/perf +%perf_make_install -C tools/lib/perf # python-perf extension -%make_install -C tools/perf \ - prefix=%{_prefix} \ - install-python_ext +%perf_make_install install-python_ext -C tools/perf # remove the 'trace' symlink. rm %{buildroot}%{_bindir}/trace