!260 fix riscv64 build error

From: @laokz 
Reviewed-by: @rosinL 
Signed-off-by: @liuqinfei
This commit is contained in:
openeuler-ci-bot 2024-05-28 02:57:59 +00:00 committed by Gitee
commit 16d507fc34
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,41 @@
diff --git a/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake b/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake
index c1a1ba0..84f224b 100644
--- a/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/src/arrow/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -32,6 +32,8 @@ if(NOT DEFINED ARROW_CPU_FLAG)
set(ARROW_CPU_FLAG "ppc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
set(ARROW_CPU_FLAG "s390x")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
+ set(ARROW_CPU_FLAG "riscv64")
else()
set(ARROW_CPU_FLAG "x86")
endif()
diff --git a/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h b/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h
index f7b7662..c1fe08d 100644
--- a/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h
+++ b/src/arrow/cpp/src/arrow/vendored/fast_float/float_common.h
@@ -10,7 +10,7 @@
|| defined(__MINGW64__) \
|| defined(__s390x__) \
|| (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) \
- || defined(__EMSCRIPTEN__))
+ || defined(__EMSCRIPTEN__) || defined(__riscv))
#define FASTFLOAT_64BIT
#elif (defined(__i386) || defined(__i386__) || defined(_M_IX86) \
|| defined(__arm__) \
diff --git a/src/common/Cycles.h b/src/common/Cycles.h
index b546479..14bc6bf 100644
--- a/src/common/Cycles.h
+++ b/src/common/Cycles.h
@@ -84,6 +84,10 @@ class Cycles {
uint64_t tsc;
asm volatile("stck %0" : "=Q" (tsc) : : "cc");
return tsc;
+#elif defined(__riscv) && __riscv_xlen == 64
+ uint64_t tsc;
+ asm volatile ("rdcycle %0" : "=r" (tsc));
+ return tsc;
#else
#warning No high-precision counter available for your OS/arch
return 0;

View File

@ -174,7 +174,7 @@
#################################################################################
Name: ceph
Version: 18.2.2
Release: 4
Release: 5
%if 0%{?fedora} || 0%{?rhel} || 0%{?openEuler}
Epoch: 2
%endif
@ -201,6 +201,10 @@ Patch4: 0004-fix-mds-metadata-lost-in-one-case.patch
Patch5: 9001-add-supprot-for-loongarch64.patch
%endif
%ifarch riscv64
Patch9002: 9002-fix-riscv64-build.patch
%endif
%if 0%{?suse_version}
# _insert_obs_source_lines_here
ExclusiveArch: x86_64 aarch64 ppc64le s390x
@ -279,7 +283,9 @@ BuildRequires: snappy-devel
BuildRequires: sqlite-devel
BuildRequires: sudo
BuildRequires: pkgconfig(udev)
%ifarch %{valgrind_arches}
BuildRequires: valgrind-devel
%endif
BuildRequires: which
BuildRequires: xfsprogs-devel
BuildRequires: xmlstarlet
@ -2637,6 +2643,10 @@ exit 0
%{_datadir}/snmp/mibs
%changelog
* Sat May 25 2024 laokz <zhangkai@iscas.ac.cn> - 2:18.2.2-5
- let BuildRequires:valgrind-devel depend on system arch macro
- fix riscv64 build
* Wed May 22 2024 zhangzikang <zhangzikang@kylinos.cn> - 2:18.2.2-4
- Add supprot for loongarch64