aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-07-08 20:44:21 -0400
committerNoah Misch <noah@leadboat.com>2015-07-08 20:44:21 -0400
commit1e700e0fa02b3fd8990d4eaa8bd51b9352cc9736 (patch)
tree4995a5b0fa2565a2cc900612291740dc822cbc4f /src
parent0d32d2e693ed69b3080be91f734c547f703b49ad (diff)
downloadpostgresql-1e700e0fa02b3fd8990d4eaa8bd51b9352cc9736.tar.gz
postgresql-1e700e0fa02b3fd8990d4eaa8bd51b9352cc9736.zip
Given a gcc-compatible xlc compiler, prefer xlc-style atomics.
This evades a ppc64le "IBM XL C/C++ for Linux" compiler bug. Back-patch to 9.5, where the atomics facility was introduced.
Diffstat (limited to 'src')
-rw-r--r--src/include/port/atomics.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h
index 1a4c748cb97..97a00641119 100644
--- a/src/include/port/atomics.h
+++ b/src/include/port/atomics.h
@@ -81,8 +81,15 @@
* * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32()
* using compiler intrinsics are a good idea.
*/
+/*
+ * Given a gcc-compatible xlc compiler, prefer the xlc implementation. The
+ * ppc64le "IBM XL C/C++ for Linux, V13.1.2" implements both interfaces, but
+ * __sync_lock_test_and_set() of one-byte types elicits SIGSEGV.
+ */
+#if defined(__IBMC__) || defined(__IBMCPP__)
+#include "port/atomics/generic-xlc.h"
/* gcc or compatible, including clang and icc */
-#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
#include "port/atomics/generic-gcc.h"
#elif defined(WIN32_ONLY_COMPILER)
#include "port/atomics/generic-msvc.h"
@@ -90,8 +97,6 @@
#include "port/atomics/generic-acc.h"
#elif defined(__SUNPRO_C) && !defined(__GNUC__)
#include "port/atomics/generic-sunpro.h"
-#elif (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__)
-#include "port/atomics/generic-xlc.h"
#else
/*
* Unsupported compiler, we'll likely use slower fallbacks... At least