Hi,
This patch adds riscv64 support to postgresql and postgresql-previous.
copied from FreeBSD ports.
ok ?
Index: databases/postgresql-previous/patches/patch-src_include_storage_s_lock_h
===================================================================
RCS file:
/cvs/ports/databases/postgresql-previous/patches/patch-src_include_storage_s_lock_h,v
retrieving revision 1.4
diff -u -p -u -r1.4 patch-src_include_storage_s_lock_h
--- databases/postgresql-previous/patches/patch-src_include_storage_s_lock_h
9 Feb 2021 20:04:10 -0000 1.4
+++ databases/postgresql-previous/patches/patch-src_include_storage_s_lock_h
12 Jul 2021 21:57:23 -0000
@@ -2,10 +2,29 @@ $OpenBSD: patch-src_include_storage_s_lo
Index: src/include/storage/s_lock.h
--- src/include/storage/s_lock.h.orig
+++ src/include/storage/s_lock.h
-@@ -739,6 +739,29 @@ typedef unsigned char slock_t;
+@@ -320,7 +320,7 @@ tas(volatile slock_t *lock)
+ * 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 @@ tas(volatile slock_t *lock)
+ #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) */
+@@ -738,6 +738,29 @@ typedef unsigned char slock_t;
+ #define S_UNLOCK(lock) \
do { __asm__ __volatile__("" : : : "memory"); *(lock) = 0; } while (0)
#endif
-
++
+#if defined(__m88k__) /* Motorola 88k */
+#define HAS_TEST_AND_SET
+
@@ -28,7 +47,6 @@ Index: src/include/storage/s_lock.h
+
+#endif /* __m88k__ */
+
-+
- #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
+ #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
Index: databases/postgresql/patches/patch-src_include_storage_s_lock_h
===================================================================
RCS file:
/cvs/ports/databases/postgresql/patches/patch-src_include_storage_s_lock_h,v
retrieving revision 1.7
diff -u -p -u -r1.7 patch-src_include_storage_s_lock_h
--- databases/postgresql/patches/patch-src_include_storage_s_lock_h 9 Feb
2021 20:01:36 -0000 1.7
+++ databases/postgresql/patches/patch-src_include_storage_s_lock_h 12 Jul
2021 21:57:23 -0000
@@ -2,10 +2,29 @@ $OpenBSD: patch-src_include_storage_s_lo
Index: src/include/storage/s_lock.h
--- src/include/storage/s_lock.h.orig
+++ src/include/storage/s_lock.h
-@@ -739,6 +739,29 @@ typedef unsigned char slock_t;
+@@ -320,7 +320,7 @@ tas(volatile slock_t *lock)
+ * 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 @@ tas(volatile slock_t *lock)
+ #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) */
+@@ -738,6 +738,29 @@ typedef unsigned char slock_t;
+ #define S_UNLOCK(lock) \
do { __asm__ __volatile__("" : : : "memory"); *(lock) = 0; } while (0)
#endif
-
++
+#if defined(__m88k__) /* Motorola 88k */
+#define HAS_TEST_AND_SET
+
@@ -28,7 +47,6 @@ Index: src/include/storage/s_lock.h
+
+#endif /* __m88k__ */
+
-+
- #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
+ #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
--
Matthieu Herrb