[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
32/38: gnu: postgresql: Fix building on riscv64-linux.
From: |
guix-commits |
Subject: |
32/38: gnu: postgresql: Fix building on riscv64-linux. |
Date: |
Sun, 10 Oct 2021 09:28:06 -0400 (EDT) |
efraim pushed a commit to branch wip-riscv
in repository guix.
commit 46f2c6356ad930e60406231a1324305de5b99748
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Thu Sep 2 15:19:09 2021 +0300
gnu: postgresql: Fix building on riscv64-linux.
* gnu/packages/databases.scm (postgresql)[source]: Add patch.
* gnu/packages/patches/postgresql-riscv-spinlocks.patch: New file.
* gnu/local.mk (dist_patch_data): Register it.
---
gnu/local.mk | 1 +
gnu/packages/databases.scm | 3 +-
.../patches/postgresql-riscv-spinlocks.patch | 41 ++++++++++++++++++++++
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index 276c668..8107b0e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1600,6 +1600,7 @@ dist_patch_DATA =
\
%D%/packages/patches/portaudio-audacity-compat.patch \
%D%/packages/patches/portmidi-modular-build.patch \
%D%/packages/patches/postgresql-disable-resolve_symlinks.patch \
+ %D%/packages/patches/postgresql-riscv-spinlocks.patch \
%D%/packages/patches/procmail-ambiguous-getline-debian.patch \
%D%/packages/patches/procmail-CVE-2014-3618.patch \
%D%/packages/patches/procmail-CVE-2017-16844.patch \
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index a15c066..57ed7a2 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -1043,7 +1043,8 @@ and high-availability (HA).")
(sha256
(base32
"1kf0gcsrl5n25rjlvkh87aywmn28kbwvakm5c7j1qpr4j01y34za"))
- (patches (search-patches
"postgresql-disable-resolve_symlinks.patch"))))
+ (patches (search-patches
"postgresql-disable-resolve_symlinks.patch"
+ "postgresql-riscv-spinlocks.patch"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags '("--with-uuid=e2fs" "--with-openssl"
diff --git a/gnu/packages/patches/postgresql-riscv-spinlocks.patch
b/gnu/packages/patches/postgresql-riscv-spinlocks.patch
new file mode 100644
index 0000000..984a573
--- /dev/null
+++ b/gnu/packages/patches/postgresql-riscv-spinlocks.patch
@@ -0,0 +1,41 @@
+https://www.postgresql.org/message-id/dea97b6d-f55f-1f6d-9109-504aa7dfa421@gentoo.org
+
+The attached patch adds native spinlock support to PostgreSQL on RISC-V
+systems. As suspected by Richard W.M. Jones of Red Hat back in 2016, the
+__sync_lock_test_and_set() approach applied on arm and arm64 works here
+as well.
+
+
+Tested against PostgreSQL 13.3 on a physical rv64gc system (BeagleV
+Starlight beta board) - builds and installs fine, all tests pass. From
+what I can see in gcc documentation this should in theory work on rv32
+(and possibly rv128) as well, therefore the patch as it stands covers
+all RISC-V systems (i.e. doesn't check the value of __risc_xlen) - but I
+haven't confirmed this experimentally.
+
+--- a/src/include/storage/s_lock.h
++++ b/src/include/storage/s_lock.h
+@@ -315,12 +315,12 @@
+ #endif /* __ia64__ || __ia64 */
+
+ /*
+- * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available.
++ * On ARM, ARM64 and RISC-V, we use __sync_lock_test_and_set(int *, int) if
available.
+ *
+ * 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(__riscv)
+ #ifdef HAVE_GCC__SYNC_INT32_TAS
+ #define HAS_TEST_AND_SET
+
+@@ -337,7 +337,7 @@
+ #define S_UNLOCK(lock) __sync_lock_release(lock)
+
+ #endif /* HAVE_GCC__SYNC_INT32_TAS */
+-#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */
++#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */
+
+
+ /* S/390 and S/390x Linux (32- and 64-bit zSeries) */
- 22/38: gnu: qemu: Skip some tests on riscv64-linux., (continued)
- 22/38: gnu: qemu: Skip some tests on riscv64-linux., guix-commits, 2021/10/10
- 02/38: gnu: gcc-boot0: Use libstdc++-boot0-gcc7 on riscv64-linux., guix-commits, 2021/10/10
- 04/38: gnu: %final-inputs: Add implied gcc:lib input., guix-commits, 2021/10/10
- 15/38: gnu: lz4: Build on riscv64-linux without valgrind., guix-commits, 2021/10/10
- 21/38: gnu: libfaketime: Adjust flags on riscv64-linux., guix-commits, 2021/10/10
- 08/38: gnu: openblas: Fix building on riscv64-linux., guix-commits, 2021/10/10
- 09/38: gnu: mesa: Add support for riscv64-linux., guix-commits, 2021/10/10
- 16/38: gnu: lapack: Fix building on riscv64-linux., guix-commits, 2021/10/10
- 17/38: gnu: texlive-latex-base: Skip JIT formats on riscv64-linux., guix-commits, 2021/10/10
- 27/38: gnu: make-opensbi-package: Adjust installed files., guix-commits, 2021/10/10
- 32/38: gnu: postgresql: Fix building on riscv64-linux.,
guix-commits <=
- 24/38: gnu: webrtc-audio-processing: Fix riscv64 detection., guix-commits, 2021/10/10
- 20/38: gnu: libaio: Fix test suite on riscv64-linux., guix-commits, 2021/10/10
- 26/38: system: system-linux-image-file-name: Set kernel name for riscv64-linux., guix-commits, 2021/10/10
- 28/38: gnu: u-boot-sifive-unmatched: Build with opensbi., guix-commits, 2021/10/10
- 29/38: gnu: dtc: Build without valgrind on riscv64-linux., guix-commits, 2021/10/10
- 34/38: build-system/meson: Fix cross-building to riscv64-linux., guix-commits, 2021/10/10
- 35/38: gnu: gtk+: Remove some more failing tests., guix-commits, 2021/10/10
- 19/38: gnu: Use libunwind-next for riscv64-linux., guix-commits, 2021/10/10
- 23/38: gnu: mozjs-60: Add support for riscv64-linux., guix-commits, 2021/10/10
- 25/38: gnu: nss: Adjust make-flags for riscv64-linux., guix-commits, 2021/10/10