summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2016-02-23 11:28:21 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-09 17:00:27 +0000
commit007c284cb83cf5d98f3e4f605244ca6f1d46caea (patch)
tree32efe1a38e908bdc64ac59cad5f7b5e6b2d99ecf /meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch
parenta27ca6da59e6939a5bbab641236f7f792c03694f (diff)
downloadpoky-007c284cb83cf5d98f3e4f605244ca6f1d46caea.tar.gz
rpm: Uprev to rpm-5.4.16 (pre) and rpm-5.4+cvs to current CVS head
meta/lib/oe/package_manager.py was also updated. This ensures that any diagnostic messages are ignored from the output of rpmresolve. The patches have been split into bug fixes (things that belong upstream) and local changes that are OE specific. The following patches are obsolete and have been removed: rpm-remove-sykcparse-decl.patch fstack-protector-configure-check.patch rpm-disable-Wno-override-init.patch rpm-lua-fix-print.patch rpm-rpmpgp-fix.patch verify-fix-broken-logic-for-ghost-avoidance-Mark-Hat.patch (From OE-Core rev: ee97e53fcceabc6ef4ddc68f38c5fa0e05c5d9a8) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch b/meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch
new file mode 100644
index 0000000000..c6327719d9
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-atomic-ops.patch
@@ -0,0 +1,73 @@
1Some architectures do not have __sync_add_and_fetch_8 implemented.
2
3MIPS (32-bit) and some PPC systems do not have sync_add_and_fetch_8.
4
5Provide an alternative. This alternative function is based on code from:
6 https://github.com/mongodb/libbson/blob/master/src/bson/bson-atomic.c
7
8Code is under an Apache 2.0 License.
9
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
13
14Index: rpm-5.4.15/rpmio/bson.h
15===================================================================
16--- rpm-5.4.15.orig/rpmio/bson.h
17+++ rpm-5.4.15/rpmio/bson.h
18@@ -879,10 +879,18 @@ BSON_END_DECLS
19
20 BSON_BEGIN_DECLS
21
22+/* Some architectures do not support __sync_add_and_fetch_8 */
23+#if (__mips == 32) || (defined(__PPC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8))
24+# define __BSON_NEED_ATOMIC_64 1
25+#endif
26
27 #if defined(__GNUC__)
28 # define bson_atomic_int_add(p, v) (__sync_add_and_fetch(p, v))
29-# define bson_atomic_int64_add(p, v) (__sync_add_and_fetch_8(p, v))
30+#ifndef __BSON_NEED_ATOMIC_64
31+# define bson_atomic_int64_add(p, v) (__sync_add_and_fetch_8(p, v))
32+# else
33+ int64_t bson_atomic_int64_add (volatile int64_t *p, int64_t n);
34+# endif
35 # define bson_memory_barrier __sync_synchronize
36 #elif defined(_MSC_VER) || defined(_WIN32)
37 # define bson_atomic_int_add(p, v) (InterlockedExchangeAdd((long int *)(p), v))
38Index: rpm-5.4.15/rpmio/bson.c
39===================================================================
40--- rpm-5.4.15.orig/rpmio/bson.c
41+++ rpm-5.4.15/rpmio/bson.c
42@@ -3863,13 +3863,30 @@ _bson_context_get_oid_seq64_threadsafe (
43 #elif defined BSON_OS_WIN32
44 uint64_t seq = InterlockedIncrement64 ((int64_t *)&context->seq64);
45 #else
46- uint64_t seq = __sync_fetch_and_add_8 (&context->seq64, 1);
47+ uint64_t seq = bson_atomic_int64_add (&context->seq64, 1);
48 #endif
49
50 seq = BSON_UINT64_TO_BE (seq);
51 memcpy (&oid->bytes[4], &seq, 8);
52 }
53
54+#ifdef __BSON_NEED_ATOMIC_64
55+#include <pthread.h>
56+static pthread_mutex_t gSync64 = PTHREAD_MUTEX_INITIALIZER;
57+int64_t
58+bson_atomic_int64_add (volatile int64_t *p,
59+ int64_t n)
60+{
61+ int64_t ret;
62+
63+ pthread_mutex_lock (&gSync64);
64+ *p += n;
65+ ret = *p;
66+ pthread_mutex_unlock (&gSync64);
67+
68+ return ret;
69+}
70+#endif
71
72 /**
73 * bson_context_new: