diff --git a/0001-tools-uapi-fix-loonarch-64-bit-support.patch b/0001-tools-uapi-fix-loonarch-64-bit-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..67cc6d355ae0be506d002a9212c42e9722095e3d --- /dev/null +++ b/0001-tools-uapi-fix-loonarch-64-bit-support.patch @@ -0,0 +1,87 @@ +--- /dev/null 2022-01-05 10:27:39.736744023 +0800 ++++ tools/arch/loongarch/include/uapi/asm/bitsperlong.h 2022-10-19 13:30:41.522009816 +0800 +@@ -0,0 +1,9 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __ASM_LOONGARCH_BITSPERLONG_H ++#define __ASM_LOONGARCH_BITSPERLONG_H ++ ++#define __BITS_PER_LONG _LOONGARCH_SZLONG ++ ++#include ++ ++#endif /* __ASM_LOONGARCH_BITSPERLONG_H */ +--- /dev/null 2022-01-05 10:27:39.736744023 +0800 ++++ tools/arch/loongarch/include/uapi/asm/perf_regs.h 2022-10-19 13:30:41.522009816 +0800 +@@ -0,0 +1,40 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef _ASM_LOONGARCH_PERF_REGS_H ++#define _ASM_LOONGARCH_PERF_REGS_H ++ ++enum perf_event_loongarch_regs { ++ PERF_REG_LOONGARCH_PC, ++ PERF_REG_LOONGARCH_R1, ++ PERF_REG_LOONGARCH_R2, ++ PERF_REG_LOONGARCH_R3, ++ PERF_REG_LOONGARCH_R4, ++ PERF_REG_LOONGARCH_R5, ++ PERF_REG_LOONGARCH_R6, ++ PERF_REG_LOONGARCH_R7, ++ PERF_REG_LOONGARCH_R8, ++ PERF_REG_LOONGARCH_R9, ++ PERF_REG_LOONGARCH_R10, ++ PERF_REG_LOONGARCH_R11, ++ PERF_REG_LOONGARCH_R12, ++ PERF_REG_LOONGARCH_R13, ++ PERF_REG_LOONGARCH_R14, ++ PERF_REG_LOONGARCH_R15, ++ PERF_REG_LOONGARCH_R16, ++ PERF_REG_LOONGARCH_R17, ++ PERF_REG_LOONGARCH_R18, ++ PERF_REG_LOONGARCH_R19, ++ PERF_REG_LOONGARCH_R20, ++ PERF_REG_LOONGARCH_R21, ++ PERF_REG_LOONGARCH_R22, ++ PERF_REG_LOONGARCH_R23, ++ PERF_REG_LOONGARCH_R24, ++ PERF_REG_LOONGARCH_R25, ++ PERF_REG_LOONGARCH_R26, ++ PERF_REG_LOONGARCH_R27, ++ PERF_REG_LOONGARCH_R28, ++ PERF_REG_LOONGARCH_R29, ++ PERF_REG_LOONGARCH_R30, ++ PERF_REG_LOONGARCH_R31, ++ PERF_REG_LOONGARCH_MAX = PERF_REG_LOONGARCH_R31 + 1, ++}; ++#endif /* _ASM_LOONGARCH_PERF_REGS_H */ +--- /dev/null 2022-01-05 10:27:39.736744023 +0800 ++++ tools/arch/loongarch/include/uapi/asm/unistd.h 2022-10-19 13:30:41.522009816 +0800 +@@ -0,0 +1,18 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++/* ++ * Copyright (C) 2020 Loongson Technology Co., Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include +--- tools/include/uapi/asm/bitsperlong.h.orig 2022-10-19 13:39:52.849341155 +0800 ++++ tools/include/uapi/asm/bitsperlong.h 2022-10-19 13:40:35.112983209 +0800 +@@ -13,6 +13,8 @@ + #include "../../../arch/mips/include/uapi/asm/bitsperlong.h" + #elif defined(__ia64__) + #include "../../../arch/ia64/include/uapi/asm/bitsperlong.h" ++#elif defined(__loongarch__) ++#include "../../../arch/loongarch/include/uapi/asm/bitsperlong.h" + #else + #include + #endif diff --git a/libbpf.spec b/libbpf.spec index 920a3ba12c50f26eecc640fcb4ede972b9f54c1f..c74bc157808f6c4a3b299888467e5e5571725171 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -1,3 +1,5 @@ +%define anolis_release .0.1 + # We build libbpf from RHEL kernel sources, that's why we use # directly kernel tar for RHEL kernel build. # We update libbpf's 'sources' file with proper hash that's @@ -9,7 +11,7 @@ Name: libbpf Version: 0.4.0 -Release: 3%{?dist} +Release: 3%{anolis_release}%{?dist} Summary: Libbpf library License: LGPLv2 or BSD @@ -17,6 +19,8 @@ Source0: %{source}.tar.xz BuildRequires: gcc elfutils-libelf-devel elfutils-devel python3 Conflicts: bcc < 0.10 +Patch1: 0001-tools-uapi-fix-loonarch-64-bit-support.patch + %description A mirror of bpf-next linux tree bpf-next/tools/lib/bpf directory plus its supporting header files. The version of the package reflects the version of @@ -45,6 +49,8 @@ developing applications that use %{name} %prep %setup -n %{source} +%patch1 -p0 + %build pushd tools/lib/bpf %{libbpf_make} prefix=%{_prefix} @@ -68,6 +74,9 @@ popd %{_libdir}/libbpf.a %changelog +* Wed Oct 19 2022 Bo Ren - 2:0.4.0-3.0.1 +- Support loongarch64 + * Thu Dec 23 2021 Jiri Olsa - 2:0.4.0-3 - kernel update - Related: rhbz#2010431