From 9a53535c1360189497666f3a22c60c6f8600e065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B6=85=E4=B8=9C?= Date: Thu, 13 Mar 2025 07:17:42 +0800 Subject: [PATCH] support sw, papi-7.0.1-support-sw.patch Project:TC2024110202 --- papi-7.0.1-support-sw.patch | 62 +++++++++++++++++++++++++++++++++++++ papi.spec | 7 ++++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 papi-7.0.1-support-sw.patch diff --git a/papi-7.0.1-support-sw.patch b/papi-7.0.1-support-sw.patch new file mode 100644 index 0000000..ee21eb0 --- /dev/null +++ b/papi-7.0.1-support-sw.patch @@ -0,0 +1,62 @@ +From 7603a62a09b16048b350de8b058777e58ebb6016 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E7=8E=8B=E8=B6=85=E4=B8=9C?= +Date: Thu, 13 Mar 2025 07:13:28 +0800 +Subject: [PATCH] support sw, papi-7.0.1-support-sw.patch + + +diff --git a/src/linux-context.h b/src/linux-context.h +index f2b118d..5dd7baa 100644 +--- a/src/linux-context.h ++++ b/src/linux-context.h +@@ -39,6 +39,8 @@ typedef ucontext_t hwd_ucontext_t; + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.__pc + #elif defined(__mips__) + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc ++#elif defined(__sw_64__) ++#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_pc + #elif defined(__hppa__) + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0] + #else +diff --git a/src/linux-timer.c b/src/linux-timer.c +index 864e6cb..2d0c3e8 100644 +--- a/src/linux-timer.c ++++ b/src/linux-timer.c +@@ -259,6 +259,21 @@ get_cycles(void) + return ret; + } + ++/************************/ ++/* sw_64 get_cycles() */ ++/************************/ ++ ++#elif defined(__sw_64__) ++static inline long long ++get_cycles( void ) ++{ ++ register unsigned long ret; ++ ++ __asm__ __volatile__ ("rtc %0" : "=r" (ret)); ++ ++ return ret; ++} ++ + /************************/ + /* POWER get_cycles() */ + /************************/ +diff --git a/src/mb.h b/src/mb.h +index 359458f..597648c 100644 +--- a/src/mb.h ++++ b/src/mb.h +@@ -26,6 +26,9 @@ + #elif defined (__alpha__) + #define rmb() asm volatile("mb" ::: "memory") + ++#elif defined (__sw_64__) ++#define rmb() asm volatile("memb" ::: "memory") ++ + #elif defined(__ia64__) + #define rmb() asm volatile ("mf" ::: "memory") + +-- +2.27.0 + diff --git a/papi.spec b/papi.spec index 7735667..6ab1edf 100644 --- a/papi.spec +++ b/papi.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 # Default to no static libraries %{!?with_static: %global with_static 0} @@ -18,6 +18,7 @@ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.g Patch1: papi-python3.patch Patch2: papi-nostatic.patch Patch3: 0001-add-loongarch64-support-for-papi.patch +Patch4: papi-7.0.1-support-sw.patch Requires: papi-libs = %{version}-%{release} BuildRequires: make @@ -96,6 +97,7 @@ The %{name}-doc package contains documentation files for %{name}. %patch1 -p1 -b .python3 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %build @@ -213,6 +215,9 @@ find %{buildroot} -type f -executable ! -iname "*.py" ! -iname "*.sh" | xargs ch %doc INSTALL.txt README.md RELEASENOTES.txt %changelog +* Thu Mar 13 2025 chaodong - 7.0.1-3 +- support sw, papi-7.0.1-support-sw.patch + * Tue Oct 10 2023 Wenlong Zhang - 7.0.1-2 - add loongarch64 support for papi - disable generate_compatibility_deps to fix build timeout -- Gitee