diff --git a/postgresql-13.3-sw.patch b/postgresql-13.3-sw.patch new file mode 100755 index 0000000000000000000000000000000000000000..f3f71c716324abbc320e3bfd7e22b14b4dba5626 --- /dev/null +++ b/postgresql-13.3-sw.patch @@ -0,0 +1,78 @@ +diff -Naur postgresql-13.3.org/contrib/pgcrypto/crypt-blowfish.c postgresql-13.3.sw/contrib/pgcrypto/crypt-blowfish.c +--- postgresql-13.3.org/contrib/pgcrypto/crypt-blowfish.c 2022-09-16 11:31:15.100000000 +0800 ++++ postgresql-13.3.sw/contrib/pgcrypto/crypt-blowfish.c 2022-09-16 11:32:01.060000000 +0800 +@@ -41,7 +41,7 @@ + #ifdef __i386__ + #define BF_ASM 0 /* 1 */ + #define BF_SCALE 1 +-#elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__) ++#elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__) || defined(__sw_64__) + #define BF_ASM 0 + #define BF_SCALE 1 + #else +diff -Naur postgresql-13.3.org/postgresql-setup-8.5/Makefile.in postgresql-13.3.sw/postgresql-setup-8.5/Makefile.in +--- postgresql-13.3.org/postgresql-setup-8.5/Makefile.in 2022-09-16 11:31:14.930000000 +0800 ++++ postgresql-13.3.sw/postgresql-setup-8.5/Makefile.in 2022-09-16 11:37:09.260000000 +0800 +@@ -459,7 +459,7 @@ + newunit = sbin/$(NAME_BINARYBASE)-new-systemd-unit + newunit_in = sbin/new-systemd-unit.in + @WANT_SYSVINIT_FALSE@sbin_SCRIPTS = $(newunit) +-HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man ++HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man --no-discard-stderr + + # The help2man call + # ================= +diff -Naur postgresql-13.3.org/src/include/port/atomics/arch-sw_64.h postgresql-13.3.sw/src/include/port/atomics/arch-sw_64.h +--- postgresql-13.3.org/src/include/port/atomics/arch-sw_64.h 1970-01-01 08:00:00.000000000 +0800 ++++ postgresql-13.3.sw/src/include/port/atomics/arch-sw_64.h 2022-09-16 13:37:10.630000000 +0800 +@@ -0,0 +1,26 @@ ++/*------------------------------------------------------------------------- ++ * ++ * arch-arm.h ++ * Atomic operations considerations specific to ARM ++ * ++ * Portions Copyright (c) 2013-2020, PostgreSQL Global Development Group ++ * ++ * NOTES: ++ * ++ * src/include/port/atomics/arch-arm.h ++ * ++ *------------------------------------------------------------------------- ++ */ ++ ++/* intentionally no include guards, should only be included by atomics.h */ ++#ifndef INSIDE_ATOMICS_H ++#error "should be included via atomics.h" ++#endif ++ ++/* ++ * 64 bit atomics on ARM32 are implemented using kernel fallbacks and thus ++ * might be slow, so disable entirely. On ARM64 that problem doesn't exist. ++ */ ++#if !defined(_sw_64__) ++#define PG_DISABLE_64_BIT_ATOMICS ++#endif /* __sw_64__ || __sw_64 */ +diff -Naur postgresql-13.3.org/src/include/port/atomics.h postgresql-13.3.sw/src/include/port/atomics.h +--- postgresql-13.3.org/src/include/port/atomics.h 2022-09-16 11:31:15.640000000 +0800 ++++ postgresql-13.3.sw/src/include/port/atomics.h 2022-09-16 13:36:15.370000000 +0800 +@@ -68,6 +68,8 @@ + #include "port/atomics/arch-arm.h" + #elif defined(__i386__) || defined(__i386) || defined(__x86_64__) + #include "port/atomics/arch-x86.h" ++#elif defined(__sw_646__) ++#include "port/atomics/arch-sw_64.h" + #elif defined(__ia64__) || defined(__ia64) + #include "port/atomics/arch-ia64.h" + #elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) +diff -Naur postgresql-13.3.org/src/include/storage/s_lock.h postgresql-13.3.sw/src/include/storage/s_lock.h +--- postgresql-13.3.org/src/include/storage/s_lock.h 2022-09-16 11:31:15.560000000 +0800 ++++ postgresql-13.3.sw/src/include/storage/s_lock.h 2022-09-16 11:43:30.940000000 +0800 +@@ -320,7 +320,7 @@ + * We use the int-width variant of the builtin because it works on more chips + * than other widths. + */ +-#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) ++#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__sw_64__) || defined(__sw_64) + #ifdef HAVE_GCC__SYNC_INT32_TAS + #define HAS_TEST_AND_SET + diff --git a/postgresql.spec b/postgresql.spec index dd657eaeb48515311bbefe42f6e53aa0ba2f89b2..db18af77580067137a6629fab58a229d63a7a94d 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -22,7 +22,11 @@ %{!?pam:%global pam 1} %{!?sdt:%global sdt 1} %{!?selinux:%global selinux 1} +%ifarch sw_64 +%{!?runselftest:%global runselftest 0} +%else %{!?runselftest:%global runselftest 1} +%endif %global _default_patch_flags --no-backup-if-mismatch @@ -32,7 +36,7 @@ Summary: PostgreSQL client programs Name: postgresql %global majorversion 13 Version: %{majorversion}.3 -Release: 6 +Release: 7 # The PostgreSQL license is very similar to other MIT licenses, but the OSI # recognizes it as an independent license, so we do as well. @@ -79,6 +83,7 @@ Patch11: postgresql-datalayout-mismatch-on-s390.patch Patch12: CVE-2021-23214.patch Patch13: CVE-2021-23222.patch Patch14: postgresql-subtransaction-test.patch +Patch15: postgresql-13.3-sw.patch BuildRequires: gcc BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk @@ -354,6 +359,9 @@ goal of accelerating analytics queries. %patch12 -p1 %patch13 -p1 %patch14 -p1 +%ifarch sw_64 +%patch15 -p1 +%endif # We used to run autoconf here, but there's no longer any real need to, # since Postgres ships with a reasonably modern configure script. @@ -1240,6 +1248,9 @@ make -C postgresql-setup-%{setup_version} check %changelog +* Tue Oct 25 2022 wuzx - 13.3-7 +- Add sw64 architecture + * Mon Aug 1 2022 bzhaoop - 13.3-6 - Porting "Fix subtransaction test failed" from master branch - Fri May 6 2022 caodongxia - 13.3-4