From e2ff5ebc0661d8d44ad3cfad7bca2ef1fa9a4aba Mon Sep 17 00:00:00 2001 From: wzx <471319475@qq.com> Date: Tue, 2 Aug 2022 16:17:47 +0800 Subject: [PATCH 1/2] sw --- DCF-1.0.0-sw.patch | 76 ++++++++++++++++++++++++++++++++++++++++++++++ opengauss-dcf.spec | 7 ++++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100755 DCF-1.0.0-sw.patch diff --git a/DCF-1.0.0-sw.patch b/DCF-1.0.0-sw.patch new file mode 100755 index 0000000..6635efb --- /dev/null +++ b/DCF-1.0.0-sw.patch @@ -0,0 +1,76 @@ +diff -Nuar DCF-1.0.0.org/CMakeLists.txt DCF-1.0.0.sw/CMakeLists.txt +--- DCF-1.0.0.org/CMakeLists.txt 2022-06-13 11:22:02.120000000 +0000 ++++ DCF-1.0.0.sw/CMakeLists.txt 2022-06-13 11:22:51.510000000 +0000 +@@ -89,7 +89,7 @@ + + add_compile_options(-mtune=cortex-a72 -fsigned-char -g -ggdb3 -march=armv8-a+crc -funwind-tables) + else () +- add_compile_options(-msse4.2 ) ++ add_compile_options( ) + endif () + Add_Definitions(-DWSEC_COMPILE_CAC_OPENSSL -DWSEC_AES_GCM_SUPPORT -DWSEC_USE_OPENSSL_110) + else () +@@ -106,4 +106,4 @@ + OPTION(TEST "option for test module" ON) + if (TEST) + add_subdirectory(test) +-endif() +\ No newline at end of file ++endif() +diff -Nuar DCF-1.0.0.org/src/common/cm_concurrency/cm_spinlock.h DCF-1.0.0.sw/src/common/cm_concurrency/cm_spinlock.h +--- DCF-1.0.0.org/src/common/cm_concurrency/cm_spinlock.h 2022-06-13 11:22:02.090000000 +0000 ++++ DCF-1.0.0.sw/src/common/cm_concurrency/cm_spinlock.h 2022-06-13 16:12:03.530000000 +0000 +@@ -68,6 +68,9 @@ + { \ + __asm__ volatile("nop"); \ + } ++#elif defined(__sw_64__) ++#define fas_cpu_pause() \ ++ {} + #else + #define fas_cpu_pause() \ + { \ +diff -Nuar DCF-1.0.0.org/src/common/cm_concurrency/cm_thread.c DCF-1.0.0.sw/src/common/cm_concurrency/cm_thread.c +--- DCF-1.0.0.org/src/common/cm_concurrency/cm_thread.c 2022-06-13 11:22:02.100000000 +0000 ++++ DCF-1.0.0.sw/src/common/cm_concurrency/cm_thread.c 2022-06-13 16:39:23.220000000 +0000 +@@ -296,6 +296,8 @@ + #define __SYS_GET_SPID 186 + #elif (defined __aarch64__) + #define __SYS_GET_SPID 178 ++#elif (defined __sw_64__) ++#define __SYS_GET_SPID 378 + #endif + #define gettid() syscall(__SYS_GET_SPID) + +diff -Nuar DCF-1.0.0.org/src/common/cm_utils/cm_checksum.h DCF-1.0.0.sw/src/common/cm_utils/cm_checksum.h +--- DCF-1.0.0.org/src/common/cm_utils/cm_checksum.h 2022-06-13 11:22:02.100000000 +0000 ++++ DCF-1.0.0.sw/src/common/cm_utils/cm_checksum.h 2022-06-13 16:33:54.130000000 +0000 +@@ -26,7 +26,7 @@ + + #include "cm_defs.h" + +-#if defined(__arm__) || defined(__aarch64__) ++#if defined(__arm__) || defined(__aarch64__) || defined(__sw_64__) + #ifdef __has_include + #if __has_include() + #include +diff -Nuar DCF-1.0.0.org/src/common/cm_utils/cm_memory.h DCF-1.0.0.sw/src/common/cm_utils/cm_memory.h +--- DCF-1.0.0.org/src/common/cm_utils/cm_memory.h 2022-06-13 11:22:02.100000000 +0000 ++++ DCF-1.0.0.sw/src/common/cm_utils/cm_memory.h 2022-06-13 16:10:02.430000000 +0000 +@@ -50,12 +50,15 @@ + __asm {mfence } \ + } + #endif +-#elif defined(__arm__) || defined(__aarch64__) ++#elif defined(__arm__) || defined(__aarch64__) + #define CM_MFENCE \ + { \ + __asm__ volatile("dmb ish" :: \ + : "memory"); \ + } ++#elif defined(__sw_64__) ++#define CM_MFENCE \ ++ {} + #else + #define CM_MFENCE \ + { \ diff --git a/opengauss-dcf.spec b/opengauss-dcf.spec index e62654a..ce9edc8 100644 --- a/opengauss-dcf.spec +++ b/opengauss-dcf.spec @@ -1,12 +1,13 @@ Name: DCF Version: 1.0.0 -Release: 2 +Release: 3 Summary: A distributed consensus framework library License: MulanPSL-2.0 URL: https://gitee.com/opengauss/DCF Source0: %{name}-%{version}.tar.gz Patch1: 01-boundcheck.patch +Patch2: DCF-1.0.0-sw.patch BuildRequires: cmake gcc gcc-c++ lz4-devel openssl-devel zstd-devel libboundscheck cjson-devel @@ -18,6 +19,7 @@ DCF is A distributed consensus framework library for openGauss %prep %setup -q %patch1 -p1 +%patch2 -p1 %build cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt @@ -40,6 +42,9 @@ cp output/lib/libdcf.* %{buildroot}/%{_prefix}/lib64 %{_prefix}/lib64/libdcf.so %changelog +* Thu Jul 28 2022 wuzx - 1.0.0-3 +- add sw64 patch + * Thu Feb 10 2022 zhangxubo - 1.0.0-2 - #I4T3R3 move library file to /usr/lib64 path. -- Gitee From c9b4d7b29df80b4e75bd9cfc5f5feb167a34e5aa Mon Sep 17 00:00:00 2001 From: wzx <471319475@qq.com> Date: Tue, 2 Aug 2022 16:42:19 +0800 Subject: [PATCH 2/2] sw --- opengauss-dcf.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opengauss-dcf.spec b/opengauss-dcf.spec index ce9edc8..69d5fe7 100644 --- a/opengauss-dcf.spec +++ b/opengauss-dcf.spec @@ -19,7 +19,9 @@ DCF is A distributed consensus framework library for openGauss %prep %setup -q %patch1 -p1 +%ifarch sw_64 %patch2 -p1 +%endif %build cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt -- Gitee