summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/db
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-01-20 23:27:48 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-21 23:44:22 +0000
commit7ce6054039849259b7f8436d66600ba5e519f93f (patch)
tree343490f41c9dc96dcc3477070412ace309f53dcf /meta/recipes-support/db
parent9a55fce4a95056a89dd4e1823275ccd4fad7e441 (diff)
downloadpoky-7ce6054039849259b7f8436d66600ba5e519f93f.tar.gz
db5: Fix build issues found with clang/libc++
This is a genuine error that is discovered when using libc++ runtime (From OE-Core rev: e4aa17ddc2ea623de2803efa9ab2fca498c99e19) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/db')
-rw-r--r--meta/recipes-support/db/db/0001-Fix-libc-compatibility-by-renaming-atomic_init-API.patch147
-rw-r--r--meta/recipes-support/db/db_5.3.28.bb1
2 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-support/db/db/0001-Fix-libc-compatibility-by-renaming-atomic_init-API.patch b/meta/recipes-support/db/db/0001-Fix-libc-compatibility-by-renaming-atomic_init-API.patch
new file mode 100644
index 0000000000..a4ff2ecb0c
--- /dev/null
+++ b/meta/recipes-support/db/db/0001-Fix-libc-compatibility-by-renaming-atomic_init-API.patch
@@ -0,0 +1,147 @@
1From a3569f118fd95b7ad41e1a1128e17c0b8928556d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 20 Jan 2019 18:30:23 -0800
4Subject: [PATCH] Fix libc++ compatibility by renaming atomic_init API
5
6db5 does not build because it is redefining a C++11 standard
7library identifier, atomic_init(). Therefore prefix all
8its internal defines with '__db_', to avoid collisions.
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/dbinc/atomic.h | 4 ++--
15 src/mp/mp_fget.c | 4 ++--
16 src/mp/mp_mvcc.c | 4 ++--
17 src/mp/mp_region.c | 4 ++--
18 src/mutex/mut_method.c | 2 +-
19 src/mutex/mut_tas.c | 4 ++--
20 6 files changed, 11 insertions(+), 11 deletions(-)
21
22diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
23index 1b49de5..7bf353c 100644
24--- a/src/dbinc/atomic.h
25+++ b/src/dbinc/atomic.h
26@@ -70,7 +70,7 @@ typedef struct {
27 * These have no memory barriers; the caller must include them when necessary.
28 */
29 #define atomic_read(p) ((p)->value)
30-#define atomic_init(p, val) ((p)->value = (val))
31+#define __db_atomic_init(p, val) ((p)->value = (val))
32
33 #ifdef HAVE_ATOMIC_SUPPORT
34
35@@ -206,7 +206,7 @@ static inline int __db_atomic_compare_exchange(
36 #define atomic_dec(env, p) (--(p)->value)
37 #define atomic_compare_exchange(env, p, oldval, newval) \
38 (DB_ASSERT(env, atomic_read(p) == (oldval)), \
39- atomic_init(p, (newval)), 1)
40+ __db_atomic_init(p, (newval)), 1)
41 #else
42 #define atomic_inc(env, p) __atomic_inc(env, p)
43 #define atomic_dec(env, p) __atomic_dec(env, p)
44diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
45index 16de695..5159520 100644
46--- a/src/mp/mp_fget.c
47+++ b/src/mp/mp_fget.c
48@@ -649,7 +649,7 @@ alloc: /* Allocate a new buffer header and data space. */
49
50 /* Initialize enough so we can call __memp_bhfree. */
51 alloc_bhp->flags = 0;
52- atomic_init(&alloc_bhp->ref, 1);
53+ __db_atomic_init(&alloc_bhp->ref, 1);
54 #ifdef DIAGNOSTIC
55 if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
56 __db_errx(env, DB_STR("3025",
57@@ -955,7 +955,7 @@ alloc: /* Allocate a new buffer header and data space. */
58 MVCC_MPROTECT(bhp->buf, mfp->pagesize,
59 PROT_READ);
60
61- atomic_init(&alloc_bhp->ref, 1);
62+ __db_atomic_init(&alloc_bhp->ref, 1);
63 MUTEX_LOCK(env, alloc_bhp->mtx_buf);
64 alloc_bhp->priority = bhp->priority;
65 alloc_bhp->pgno = bhp->pgno;
66diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
67index 770bad8..dbce4f3 100644
68--- a/src/mp/mp_mvcc.c
69+++ b/src/mp/mp_mvcc.c
70@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
71 #else
72 memcpy(frozen_bhp, bhp, SSZA(BH, buf));
73 #endif
74- atomic_init(&frozen_bhp->ref, 0);
75+ __db_atomic_init(&frozen_bhp->ref, 0);
76 if (mutex != MUTEX_INVALID)
77 frozen_bhp->mtx_buf = mutex;
78 else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
79@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
80 #endif
81 alloc_bhp->mtx_buf = mutex;
82 MUTEX_LOCK(env, alloc_bhp->mtx_buf);
83- atomic_init(&alloc_bhp->ref, 1);
84+ __db_atomic_init(&alloc_bhp->ref, 1);
85 F_CLR(alloc_bhp, BH_FROZEN);
86 }
87
88diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
89index 4952030..084f499 100644
90--- a/src/mp/mp_region.c
91+++ b/src/mp/mp_region.c
92@@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
93 MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
94 return (ret);
95 SH_TAILQ_INIT(&htab[i].hash_bucket);
96- atomic_init(&htab[i].hash_page_dirty, 0);
97+ __db_atomic_init(&htab[i].hash_page_dirty, 0);
98 }
99
100 /*
101@@ -302,7 +302,7 @@ no_prealloc:
102 } else
103 hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
104 SH_TAILQ_INIT(&hp->hash_bucket);
105- atomic_init(&hp->hash_page_dirty, 0);
106+ __db_atomic_init(&hp->hash_page_dirty, 0);
107 #ifdef HAVE_STATISTICS
108 hp->hash_io_wait = 0;
109 hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
110diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
111index 09353b0..3c954b9 100644
112--- a/src/mutex/mut_method.c
113+++ b/src/mutex/mut_method.c
114@@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
115 MUTEX_LOCK(env, mtx);
116 ret = atomic_read(v) == oldval;
117 if (ret)
118- atomic_init(v, newval);
119+ __db_atomic_init(v, newval);
120 MUTEX_UNLOCK(env, mtx);
121
122 return (ret);
123diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
124index 106b161..5a3b033 100644
125--- a/src/mutex/mut_tas.c
126+++ b/src/mutex/mut_tas.c
127@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
128
129 #ifdef HAVE_SHARED_LATCHES
130 if (F_ISSET(mutexp, DB_MUTEX_SHARED))
131- atomic_init(&mutexp->sharecount, 0);
132+ __db_atomic_init(&mutexp->sharecount, 0);
133 else
134 #endif
135 if (MUTEX_INIT(&mutexp->tas)) {
136@@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
137 F_CLR(mutexp, DB_MUTEX_LOCKED);
138 /* Flush flag update before zeroing count */
139 MEMBAR_EXIT();
140- atomic_init(&mutexp->sharecount, 0);
141+ __db_atomic_init(&mutexp->sharecount, 0);
142 } else {
143 DB_ASSERT(env, sharecount > 0);
144 MEMBAR_EXIT();
145--
1462.20.1
147
diff --git a/meta/recipes-support/db/db_5.3.28.bb b/meta/recipes-support/db/db_5.3.28.bb
index b7ed2c798c..46536efe86 100644
--- a/meta/recipes-support/db/db_5.3.28.bb
+++ b/meta/recipes-support/db/db_5.3.28.bb
@@ -25,6 +25,7 @@ SRC_URI += "file://fix-parallel-build.patch \
25 file://0001-atomic-Rename-local-__atomic_compare_exchange-to-avo.patch \ 25 file://0001-atomic-Rename-local-__atomic_compare_exchange-to-avo.patch \
26 file://0001-configure-Add-explicit-tag-options-to-libtool-invoca.patch \ 26 file://0001-configure-Add-explicit-tag-options-to-libtool-invoca.patch \
27 file://sequence-type.patch \ 27 file://sequence-type.patch \
28 file://0001-Fix-libc-compatibility-by-renaming-atomic_init-API.patch \
28 " 29 "
29# We are not interested in official latest 6.x versions; 30# We are not interested in official latest 6.x versions;
30# let's track what debian is using. 31# let's track what debian is using.