From 3991b4cc870b35748903adfe3078036196e4508e Mon Sep 17 00:00:00 2001 From: psong Date: Sun, 6 Oct 2024 19:49:23 +0800 Subject: [PATCH] fix 'rdcycle' illegal instructor error update --- ...aledcycleclock-remove-RISC-V-support.patch | 49 +++++++++++++++++++ autofdo.spec | 13 +++-- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 0002-unscaledcycleclock-remove-RISC-V-support.patch diff --git a/0002-unscaledcycleclock-remove-RISC-V-support.patch b/0002-unscaledcycleclock-remove-RISC-V-support.patch new file mode 100644 index 0000000..f104a2e --- /dev/null +++ b/0002-unscaledcycleclock-remove-RISC-V-support.patch @@ -0,0 +1,49 @@ +diff --git a/third_party/abseil/absl/base/internal/unscaledcycleclock.cc b/third_party/abseil/absl/base/internal/unscaledcycleclock.cc +index 05e0e7b..a0bf3a6 100644 +--- a/third_party/abseil/absl/base/internal/unscaledcycleclock.cc ++++ b/third_party/abseil/absl/base/internal/unscaledcycleclock.cc +@@ -121,18 +121,6 @@ double UnscaledCycleClock::Frequency() { + return aarch64_timer_frequency; + } + +-#elif defined(__riscv) +- +-int64_t UnscaledCycleClock::Now() { +- int64_t virtual_timer_value; +- asm volatile("rdcycle %0" : "=r"(virtual_timer_value)); +- return virtual_timer_value; +-} +- +-double UnscaledCycleClock::Frequency() { +- return base_internal::NominalCPUFrequency(); +-} +- + #elif defined(_M_IX86) || defined(_M_X64) + + #pragma intrinsic(__rdtsc) +diff --git a/third_party/abseil/absl/base/internal/unscaledcycleclock_config.h b/third_party/abseil/absl/base/internal/unscaledcycleclock_config.h +index 24b324a..43a3dab 100644 +--- a/third_party/abseil/absl/base/internal/unscaledcycleclock_config.h ++++ b/third_party/abseil/absl/base/internal/unscaledcycleclock_config.h +@@ -21,8 +21,8 @@ + + // The following platforms have an implementation of a hardware counter. + #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ +- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \ +- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC)) ++ defined(__powerpc__) || defined(__ppc__) || defined(_M_IX86) || \ ++ (defined(_M_X64) && !defined(_M_ARM64EC)) + #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1 + #else + #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 0 +@@ -53,8 +53,8 @@ + #if ABSL_USE_UNSCALED_CYCLECLOCK + // This macro can be used to test if UnscaledCycleClock::Frequency() + // is NominalCPUFrequency() on a particular platform. +-#if (defined(__i386__) || defined(__x86_64__) || defined(__riscv) || \ +- defined(_M_IX86) || defined(_M_X64)) ++#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \ ++ defined(_M_X64)) + #define ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY + #endif + #endif diff --git a/autofdo.spec b/autofdo.spec index b50ecd6..110a40b 100644 --- a/autofdo.spec +++ b/autofdo.spec @@ -1,18 +1,19 @@ Name: autofdo Version: 0.30.1 -Release: 1 +Release: 2 Summary: A tool to convert perf.data profile to AutoFDO profile License: Apache-2.0 URL: https://github.com/google/autofdo # The package in the original url below contains GIT information which is useless, # so remove the GIT information and repackage it. Source0: %{name}-%{version}.tar.xz - Patch1: 0001-adjust-the-link-method-of-dependency-libraries.patch - +Patch2: 0002-unscaledcycleclock-remove-RISC-V-support.patch BuildRequires: gcc gcc-c++ libtool git cmake elfutils-libelf-devel openssl-devel pkg-config ninja-build gtest libunwind-devel protobuf-devel chrpath Requires: glibc openssl-libs elfutils libgcc libstdc++ zlib + + %description This package contains a tool to convert perf.data profile to AutoFDO profile that can be used by GCC and LLVM. @@ -37,6 +38,12 @@ cp %{_builddir}/%{name}-%{version}/profile_merger ./ %{_bindir}/profile_merger %changelog +* Sun Oct 6 2024 pSomng - 0.30.1-2 +- Type:update +- ID:NA +- SUG:NA +- DESC: backport absel update for rdcycle + * Tue Aug 6 2024 rfwang07 - 0.30.1-1 - Type:Update - ID:NA -- Gitee