aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichi Lumin <[email protected]>2018-06-01 20:27:25 -0600
committerRoss Nicoll <[email protected]>2019-03-25 05:36:12 +0000
commitb0ac2c461fd59386552d86e87c3a70b6462c8b3f (patch)
tree17a9d9d6e29f1f948accc626a8d557b0231a488e
parent Notes on BDB 5.1.29 clang patches (diff)
downloaddiscoin-b0ac2c461fd59386552d86e87c3a70b6462c8b3f.tar.xz
discoin-b0ac2c461fd59386552d86e87c3a70b6462c8b3f.zip
Required patches to compile bdb 5.1.29 via clang on OSX
These patches must be applied to the bdb-5.1.29 source from Oracle, and then compiled, for the Mac client to build. Using an existing 5.1.29 binary will not work; as it was likely compiled with gcc; which OSX no longer natively supports.
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/atomic.h.patch38
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/mp_fget.c.patch20
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/mp_mvcc.c.patch20
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/mp_region.c.patch20
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/mut_method.c.patch11
-rw-r--r--depends/patches/bdb-5.1.29-clang-osx/mut_tas.c.patch20
6 files changed, 129 insertions, 0 deletions
diff --git a/depends/patches/bdb-5.1.29-clang-osx/atomic.h.patch b/depends/patches/bdb-5.1.29-clang-osx/atomic.h.patch
new file mode 100644
index 000000000..c702e2b53
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/atomic.h.patch
@@ -0,0 +1,38 @@
+--- old-bdb/src/dbinc/atomic.h 2011-10-25 14:39:34.000000000 -0600
++++ new-bdb/src/dbinc/atomic.h 2018-06-01 19:59:37.000000000 -0600
+@@ -70,7 +70,7 @@
+ * These have no memory barriers; the caller must include them when necessary.
+ */
+ #define atomic_read(p) ((p)->value)
+-#define atomic_init(p, val) ((p)->value = (val))
++#define atomic_init_db(p, val) ((p)->value = (val))
+
+ #ifdef HAVE_ATOMIC_SUPPORT
+
+@@ -144,7 +144,7 @@
+ #define atomic_inc(env, p) __atomic_inc(p)
+ #define atomic_dec(env, p) __atomic_dec(p)
+ #define atomic_compare_exchange(env, p, o, n) \
+- __atomic_compare_exchange((p), (o), (n))
++ __atomic_compare_exchange_db((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ int temp;
+@@ -176,7 +176,7 @@
+ * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+ * which configure could be changed to use.
+ */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_db(
+ db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ atomic_value_t was;
+@@ -206,7 +206,7 @@
+ #define atomic_dec(env, p) (--(p)->value)
+ #define atomic_compare_exchange(env, p, oldval, newval) \
+ (DB_ASSERT(env, atomic_read(p) == (oldval)), \
+- atomic_init(p, (newval)), 1)
++ atomic_init_db(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p) __atomic_inc(env, p)
+ #define atomic_dec(env, p) __atomic_dec(env, p)
diff --git a/depends/patches/bdb-5.1.29-clang-osx/mp_fget.c.patch b/depends/patches/bdb-5.1.29-clang-osx/mp_fget.c.patch
new file mode 100644
index 000000000..a524da7ac
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/mp_fget.c.patch
@@ -0,0 +1,20 @@
+--- old-bdb/src/mp/mp_fget.c 2011-10-25 14:39:35.000000000 -0600
++++ new-bdb/src/mp/mp_fget.c 2018-06-01 20:01:48.000000000 -0600
+@@ -629,7 +629,7 @@
+
+ /* Initialize enough so we can call __memp_bhfree. */
+ alloc_bhp->flags = 0;
+- atomic_init(&alloc_bhp->ref, 1);
++ atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ __db_errx(env,
+@@ -931,7 +931,7 @@
+ MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ PROT_READ);
+
+- atomic_init(&alloc_bhp->ref, 1);
++ atomic_init_db(&alloc_bhp->ref, 1);
+ MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ alloc_bhp->priority = bhp->priority;
+ alloc_bhp->pgno = bhp->pgno;
diff --git a/depends/patches/bdb-5.1.29-clang-osx/mp_mvcc.c.patch b/depends/patches/bdb-5.1.29-clang-osx/mp_mvcc.c.patch
new file mode 100644
index 000000000..a12084208
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/mp_mvcc.c.patch
@@ -0,0 +1,20 @@
+--- old-bdb/src/mp/mp_mvcc.c 2011-10-25 14:39:35.000000000 -0600
++++ new-bdb/src/mp/mp_mvcc.c 2018-06-01 20:02:45.000000000 -0600
+@@ -276,7 +276,7 @@
+ #else
+ memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+- atomic_init(&frozen_bhp->ref, 0);
++ atomic_init_db(&frozen_bhp->ref, 0);
+ if (mutex != MUTEX_INVALID)
+ frozen_bhp->mtx_buf = mutex;
+ else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@
+ #endif
+ alloc_bhp->mtx_buf = mutex;
+ MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+- atomic_init(&alloc_bhp->ref, 1);
++ atomic_init_db(&alloc_bhp->ref, 1);
+ F_CLR(alloc_bhp, BH_FROZEN);
+ }
+
diff --git a/depends/patches/bdb-5.1.29-clang-osx/mp_region.c.patch b/depends/patches/bdb-5.1.29-clang-osx/mp_region.c.patch
new file mode 100644
index 000000000..713d9ca69
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/mp_region.c.patch
@@ -0,0 +1,20 @@
+--- old-bdb/src/mp/mp_region.c 2011-10-25 14:39:35.000000000 -0600
++++ new-bdb/src/mp/mp_region.c 2018-06-01 20:03:28.000000000 -0600
+@@ -229,7 +229,7 @@
+ MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ return (ret);
+ SH_TAILQ_INIT(&htab[i].hash_bucket);
+- atomic_init(&htab[i].hash_page_dirty, 0);
++ atomic_init_db(&htab[i].hash_page_dirty, 0);
+ }
+
+ /*
+@@ -275,7 +275,7 @@
+ hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
+ mtx_base + (i % dbenv->mp_mtxcount);
+ SH_TAILQ_INIT(&hp->hash_bucket);
+- atomic_init(&hp->hash_page_dirty, 0);
++ atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ hp->hash_io_wait = 0;
+ hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
diff --git a/depends/patches/bdb-5.1.29-clang-osx/mut_method.c.patch b/depends/patches/bdb-5.1.29-clang-osx/mut_method.c.patch
new file mode 100644
index 000000000..95efc8dad
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/mut_method.c.patch
@@ -0,0 +1,11 @@
+--- old-bdb/src/mutex/mut_method.c 2011-10-25 14:39:35.000000000 -0600
++++ new-bdb/src/mutex/mut_method.c 2018-06-01 20:04:05.000000000 -0600
+@@ -428,7 +428,7 @@
+ MUTEX_LOCK(env, mtx);
+ ret = atomic_read(v) == oldval;
+ if (ret)
+- atomic_init(v, newval);
++ atomic_init_db(v, newval);
+ MUTEX_UNLOCK(env, mtx);
+
+ return (ret);
diff --git a/depends/patches/bdb-5.1.29-clang-osx/mut_tas.c.patch b/depends/patches/bdb-5.1.29-clang-osx/mut_tas.c.patch
new file mode 100644
index 000000000..5f9ed1398
--- /dev/null
+++ b/depends/patches/bdb-5.1.29-clang-osx/mut_tas.c.patch
@@ -0,0 +1,20 @@
+--- old-bdb/src/mutex/mut_tas.c 2011-10-25 14:39:35.000000000 -0600
++++ new-bdb/src/mutex/mut_tas.c 2018-06-01 20:04:25.000000000 -0600
+@@ -48,7 +48,7 @@
+
+ #ifdef HAVE_SHARED_LATCHES
+ if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+- atomic_init(&mutexp->sharecount, 0);
++ atomic_init_db(&mutexp->sharecount, 0);
+ else
+ #endif
+ if (MUTEX_INIT(&mutexp->tas)) {
+@@ -521,7 +521,7 @@
+ F_CLR(mutexp, DB_MUTEX_LOCKED);
+ /* Flush flag update before zeroing count */
+ MEMBAR_EXIT();
+- atomic_init(&mutexp->sharecount, 0);
++ atomic_init_db(&mutexp->sharecount, 0);
+ } else {
+ DB_ASSERT(env, sharecount > 0);
+ MEMBAR_EXIT();