From cfa64be0003748d3f61d74a8b18c421494ab1c04 Mon Sep 17 00:00:00 2001 From: Hailiang Date: Fri, 7 Mar 2025 11:31:57 +0800 Subject: [PATCH] add sw_64 support Signed-off-by: Hailiang --- add-sw_64-support.patch | 78 +++++++++++++++++++++++++++++++++++++++++ redis5.spec | 9 ++++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 add-sw_64-support.patch diff --git a/add-sw_64-support.patch b/add-sw_64-support.patch new file mode 100644 index 0000000..d84b89b --- /dev/null +++ b/add-sw_64-support.patch @@ -0,0 +1,78 @@ +diff --git a/deps/jemalloc/build-aux/config.guess b/deps/jemalloc/build-aux/config.guess +index 2e9ad7f..3c0a9de 100755 +--- a/deps/jemalloc/build-aux/config.guess ++++ b/deps/jemalloc/build-aux/config.guess +@@ -915,6 +915,14 @@ EOF + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi ++ echo ${UNAME_MACHINE}-sunway-linux-${LIBC} ++ exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; +diff --git a/deps/jemalloc/build-aux/config.sub b/deps/jemalloc/build-aux/config.sub +index dd2ca93..bbc1e5a 100755 +--- a/deps/jemalloc/build-aux/config.sub ++++ b/deps/jemalloc/build-aux/config.sub +@@ -248,6 +248,7 @@ case $basic_machine in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ ++ | sw_64 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ +@@ -372,6 +373,7 @@ case $basic_machine in + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ ++ | sw_64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ +diff --git a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h +index 1b750b1..704d52b 100644 +--- a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h ++++ b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h +@@ -64,6 +64,9 @@ typedef int malloc_cpuid_t; + # ifdef __alpha__ + # define LG_QUANTUM 4 + # endif ++# ifdef __sw_64__ ++# define LG_QUANTUM 4 ++# endif + # if (defined(__sparc64__) || defined(__sparcv9) || defined(__sparc_v9__)) + # define LG_QUANTUM 4 + # endif +diff --git a/src/config.h b/src/config.h +index efa9d11..7e8f9d5 100644 +--- a/src/config.h ++++ b/src/config.h +@@ -147,7 +147,8 @@ void setproctitle(const char *fmt, ...); + #if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \ + defined(vax) || defined(ns32000) || defined(sun386) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ +- defined(__alpha__) || defined(__alpha) ++ defined(__alpha__) || defined(__alpha) || \ ++ defined(__sw_64__) || defined(__sw_64) + #define BYTE_ORDER LITTLE_ENDIAN + #endif + +@@ -217,6 +218,10 @@ void setproctitle(const char *fmt, ...); + #define __arm64__ + #endif + ++#if defined (__sw_64__) ++#define __sw_64__ ++#endif ++ + /* Make sure we can test for SPARC just checking for __sparc__. */ + #if defined(__sparc) && !defined(__sparc__) + #define __sparc__ diff --git a/redis5.spec b/redis5.spec index ad7d0b3..4cf0b2b 100644 --- a/redis5.spec +++ b/redis5.spec @@ -6,7 +6,7 @@ %global Pname redis Name: redis5 Version: 5.0.14 -Release: 3 +Release: 4 Summary: A persistent key-value database License: BSD and MIT URL: https://redis.io @@ -27,6 +27,7 @@ Patch0002: Fix-display-error-message.patch Patch0003: Add-loongarch64-support.patch Patch0004: Update-config.guess-and-config.sub.patch +Patch0005: add-sw_64-support.patch BuildRequires: gcc %if %{with tests} @@ -92,6 +93,9 @@ tar -xvf %{SOURCE10} %patch0003 -p1 %patch0004 -p1 %endif +%ifarch sw_64 +%patch0005 -p1 +%endif mv ../%{Pname}-doc-%{doc_commit} doc mv deps/lua/COPYRIGHT COPYRIGHT-lua mv deps/hiredis/COPYING COPYING-hiredis @@ -196,6 +200,9 @@ exit 0 %{_docdir}/%{Pname} %changelog +* Fri Mar 07 2025 mahailiang - 5.0.14-4 +- add sw_64 support + * Tue Nov 15 2022 huajingyun - 5.0.14-3 - Update config.guess and config.sub for loongarch -- Gitee