aboutsummaryrefslogtreecommitdiffstats
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)
downloadopenembedded-core-contrib-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 @@
+Some architectures do not have __sync_add_and_fetch_8 implemented.
+
+MIPS (32-bit) and some PPC systems do not have sync_add_and_fetch_8.
+
+Provide an alternative. This alternative function is based on code from:
+ https://github.com/mongodb/libbson/blob/master/src/bson/bson-atomic.c
+
+Code is under an Apache 2.0 License.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: rpm-5.4.15/rpmio/bson.h
+===================================================================
+--- rpm-5.4.15.orig/rpmio/bson.h
++++ rpm-5.4.15/rpmio/bson.h
+@@ -879,10 +879,18 @@ BSON_END_DECLS
+
+ BSON_BEGIN_DECLS
+
++/* Some architectures do not support __sync_add_and_fetch_8 */
++#if (__mips == 32) || (defined(__PPC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8))
++# define __BSON_NEED_ATOMIC_64 1
++#endif
+
+ #if defined(__GNUC__)
+ # define bson_atomic_int_add(p, v) (__sync_add_and_fetch(p, v))
+-# define bson_atomic_int64_add(p, v) (__sync_add_and_fetch_8(p, v))
++#ifndef __BSON_NEED_ATOMIC_64
++# define bson_atomic_int64_add(p, v) (__sync_add_and_fetch_8(p, v))
++# else
++ int64_t bson_atomic_int64_add (volatile int64_t *p, int64_t n);
++# endif
+ # define bson_memory_barrier __sync_synchronize
+ #elif defined(_MSC_VER) || defined(_WIN32)
+ # define bson_atomic_int_add(p, v) (InterlockedExchangeAdd((long int *)(p), v))
+Index: rpm-5.4.15/rpmio/bson.c
+===================================================================
+--- rpm-5.4.15.orig/rpmio/bson.c
++++ rpm-5.4.15/rpmio/bson.c
+@@ -3863,13 +3863,30 @@ _bson_context_get_oid_seq64_threadsafe (
+ #elif defined BSON_OS_WIN32
+ uint64_t seq = InterlockedIncrement64 ((int64_t *)&context->seq64);
+ #else
+- uint64_t seq = __sync_fetch_and_add_8 (&context->seq64, 1);
++ uint64_t seq = bson_atomic_int64_add (&context->seq64, 1);
+ #endif
+
+ seq = BSON_UINT64_TO_BE (seq);
+ memcpy (&oid->bytes[4], &seq, 8);
+ }
+
++#ifdef __BSON_NEED_ATOMIC_64
++#include <pthread.h>
++static pthread_mutex_t gSync64 = PTHREAD_MUTEX_INITIALIZER;
++int64_t
++bson_atomic_int64_add (volatile int64_t *p,
++ int64_t n)
++{
++ int64_t ret;
++
++ pthread_mutex_lock (&gSync64);
++ *p += n;
++ ret = *p;
++ pthread_mutex_unlock (&gSync64);
++
++ return ret;
++}
++#endif
+
+ /**
+ * bson_context_new: