Skip to content

Commit

Permalink
Update leveldb-1.4.patch to support PowerPC LE platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhiwei authored and vinodkone committed Mar 31, 2016
1 parent 66cddaf commit b2e6228
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 3rdparty/leveldb-1.4.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,30 @@ index b71bf02..864e5fb 100755
fi

PLATFORM_CCFLAGS="$PLATFORM_CCFLAGS $COMMON_FLAGS"
diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h
index 35ae550..b4769b3 100644
--- a/port/atomic_pointer.h
+++ b/port/atomic_pointer.h
@@ -36,6 +36,8 @@
#define ARCH_CPU_X86_FAMILY 1
#elif defined(__ARMEL__)
#define ARCH_CPU_ARM_FAMILY 1
+#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__)
+#define ARCH_CPU_PPC_FAMILY 1
#endif

namespace leveldb {
@@ -83,6 +85,13 @@ inline void MemoryBarrier() {
}
#define LEVELDB_HAVE_MEMORY_BARRIER

+// PPC
+#elif defined(ARCH_CPU_PPC_FAMILY) && defined(__GNUC__)
+inline void MemoryBarrier() {
+ asm volatile("lwsync" : : : "memory");
+}
+#define LEVELDB_HAVE_MEMORY_BARRIER
+
#endif

// AtomicPointer built using platform-specific MemoryBarrier()

0 comments on commit b2e6228

Please sign in to comment.