!20 [sync] PR-17: add support for loongarch64
From: @openeuler-sync-bot Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
ffc3b45a85
84
0001-add-loongarch64-support.patch
Normal file
84
0001-add-loongarch64-support.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
From 8bc1a92d8f9275bf608ebf7b4b49cf64484f2d45 Mon Sep 17 00:00:00 2001
|
||||||
|
From: herengui <herengui@kylinsec.com.cn>
|
||||||
|
Date: Mon, 22 May 2023 11:31:12 +0800
|
||||||
|
Subject: [PATCH] add loongarch64 support
|
||||||
|
|
||||||
|
Signed-off-by: herengui <herengui@kylinsec.com.cn>
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 2 ++
|
||||||
|
src/common/cm_concurrency/cm_spinlock.h | 3 +++
|
||||||
|
src/common/cm_concurrency/cm_thread.c | 2 +-
|
||||||
|
src/common/cm_utils/cm_checksum.h | 2 +-
|
||||||
|
src/common/cm_utils/cm_memory.h | 3 +++
|
||||||
|
5 files changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 81d310b..54ffffe 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -88,6 +88,8 @@ if (UNIX)
|
||||||
|
endif (USE_H1620)
|
||||||
|
|
||||||
|
add_compile_options(-mtune=cortex-a72 -fsigned-char -g -ggdb3 -march=armv8-a+crc -funwind-tables)
|
||||||
|
+ elseif (OS_ARCH STREQUAL "loongarch64")
|
||||||
|
+ add_compile_options(-march=loongarch64 )
|
||||||
|
else ()
|
||||||
|
add_compile_options(-msse4.2 )
|
||||||
|
endif ()
|
||||||
|
diff --git a/src/common/cm_concurrency/cm_spinlock.h b/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
index 7965853..ef4755d 100644
|
||||||
|
--- a/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
+++ b/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
@@ -68,6 +68,9 @@ typedef struct st_spin_statis {
|
||||||
|
{ \
|
||||||
|
__asm__ volatile("nop"); \
|
||||||
|
}
|
||||||
|
+#elif defined(__loongarch__)
|
||||||
|
+#define fas_cpu_pause() \
|
||||||
|
+ {}
|
||||||
|
#else
|
||||||
|
#define fas_cpu_pause() \
|
||||||
|
{ \
|
||||||
|
diff --git a/src/common/cm_concurrency/cm_thread.c b/src/common/cm_concurrency/cm_thread.c
|
||||||
|
index 2d0aa2a..266abba 100644
|
||||||
|
--- a/src/common/cm_concurrency/cm_thread.c
|
||||||
|
+++ b/src/common/cm_concurrency/cm_thread.c
|
||||||
|
@@ -294,7 +294,7 @@ uint32 cm_get_current_thread_id()
|
||||||
|
{
|
||||||
|
#if (defined __x86_64__)
|
||||||
|
#define __SYS_GET_SPID 186
|
||||||
|
-#elif (defined __aarch64__)
|
||||||
|
+#elif defined(__aarch64__) || defined(__loongarch__)
|
||||||
|
#define __SYS_GET_SPID 178
|
||||||
|
#endif
|
||||||
|
#define gettid() syscall(__SYS_GET_SPID)
|
||||||
|
diff --git a/src/common/cm_utils/cm_checksum.h b/src/common/cm_utils/cm_checksum.h
|
||||||
|
index 85bb9fa..8e05e5a 100644
|
||||||
|
--- a/src/common/cm_utils/cm_checksum.h
|
||||||
|
+++ b/src/common/cm_utils/cm_checksum.h
|
||||||
|
@@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
#include "cm_defs.h"
|
||||||
|
|
||||||
|
-#if defined(__arm__) || defined(__aarch64__)
|
||||||
|
+#if defined(__arm__) || defined(__aarch64__) || defined(__loongarch__)
|
||||||
|
#ifdef __has_include
|
||||||
|
#if __has_include(<arm_acle.h>)
|
||||||
|
#include <arm_acle.h>
|
||||||
|
diff --git a/src/common/cm_utils/cm_memory.h b/src/common/cm_utils/cm_memory.h
|
||||||
|
index 988b78e..d6494fb 100644
|
||||||
|
--- a/src/common/cm_utils/cm_memory.h
|
||||||
|
+++ b/src/common/cm_utils/cm_memory.h
|
||||||
|
@@ -56,6 +56,9 @@ extern "C" {
|
||||||
|
__asm__ volatile("dmb ish" :: \
|
||||||
|
: "memory"); \
|
||||||
|
}
|
||||||
|
+#elif defined(__loongarch__)
|
||||||
|
+#define CM_MFENCE \
|
||||||
|
+ {}
|
||||||
|
#else
|
||||||
|
#define CM_MFENCE \
|
||||||
|
{ \
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: DCF
|
Name: DCF
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: A distributed consensus framework library
|
Summary: A distributed consensus framework library
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
URL: https://gitee.com/opengauss/DCF
|
URL: https://gitee.com/opengauss/DCF
|
||||||
@ -8,6 +8,7 @@ Source0: %{name}-%{version}.tar.gz
|
|||||||
|
|
||||||
Patch1: 01-boundcheck.patch
|
Patch1: 01-boundcheck.patch
|
||||||
Patch2: DCF-1.0.0-sw.patch
|
Patch2: DCF-1.0.0-sw.patch
|
||||||
|
Patch3: 0001-add-loongarch64-support.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc gcc-c++ lz4-devel openssl-devel zstd-devel libboundscheck cjson-devel
|
BuildRequires: cmake gcc gcc-c++ lz4-devel openssl-devel zstd-devel libboundscheck cjson-devel
|
||||||
|
|
||||||
@ -22,6 +23,9 @@ DCF is A distributed consensus framework library for openGauss
|
|||||||
%ifarch sw_64
|
%ifarch sw_64
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%ifarch loongarch64
|
||||||
|
%patch3 -p1
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt
|
cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt
|
||||||
@ -30,17 +34,9 @@ cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=O
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}/%{_prefix}/include
|
mkdir -p %{buildroot}/%{_prefix}/include
|
||||||
%ifarch sw_64
|
mkdir -p %{buildroot}/%{_libdir}
|
||||||
mkdir -p %{buildroot}/%{_prefix}/lib
|
|
||||||
%else
|
|
||||||
mkdir -p %{buildroot}/%{_prefix}/lib64
|
|
||||||
%endif
|
|
||||||
cp src/interface/dcf_interface.h %{buildroot}/%{_prefix}/include
|
cp src/interface/dcf_interface.h %{buildroot}/%{_prefix}/include
|
||||||
%ifarch sw_64
|
cp output/lib/libdcf.* %{buildroot}/%{_libdir}
|
||||||
cp output/lib/libdcf.* %{buildroot}/%{_prefix}/lib
|
|
||||||
%else
|
|
||||||
cp output/lib/libdcf.* %{buildroot}/%{_prefix}/lib64
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
|
||||||
@ -49,13 +45,12 @@ cp output/lib/libdcf.* %{buildroot}/%{_prefix}/lib64
|
|||||||
%files
|
%files
|
||||||
%defattr (-,root,root)
|
%defattr (-,root,root)
|
||||||
%{_prefix}/include/dcf_interface.h
|
%{_prefix}/include/dcf_interface.h
|
||||||
%ifarch sw_64
|
%{_libdir}/libdcf.so
|
||||||
%{_prefix}/lib/libdcf.so
|
|
||||||
%else
|
|
||||||
%{_prefix}/lib64/libdcf.so
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 7 2023 panchenbo <panchenbo@kylinsec.com.cn> - 1.0.0-5
|
||||||
|
- add support for loongarch64
|
||||||
|
|
||||||
* Mon Oct 24 2022 wuzx<wuzx1226@qq.com> - 1.0.0-4
|
* Mon Oct 24 2022 wuzx<wuzx1226@qq.com> - 1.0.0-4
|
||||||
- change lib64 to lib when in sw64 architecture
|
- change lib64 to lib when in sw64 architecture
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user