Skip to content

Commit 1e700e0

Browse files
committed
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.
1 parent 0d32d2e commit 1e700e0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/include/port/atomics.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,22 @@
8181
* * pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32()
8282
* using compiler intrinsics are a good idea.
8383
*/
84+
/*
85+
* Given a gcc-compatible xlc compiler, prefer the xlc implementation. The
86+
* ppc64le "IBM XL C/C++ for Linux, V13.1.2" implements both interfaces, but
87+
* __sync_lock_test_and_set() of one-byte types elicits SIGSEGV.
88+
*/
89+
#if defined(__IBMC__) || defined(__IBMCPP__)
90+
#include "port/atomics/generic-xlc.h"
8491
/* gcc or compatible, including clang and icc */
85-
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
92+
#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
8693
#include "port/atomics/generic-gcc.h"
8794
#elif defined(WIN32_ONLY_COMPILER)
8895
#include "port/atomics/generic-msvc.h"
8996
#elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__)
9097
#include "port/atomics/generic-acc.h"
9198
#elif defined(__SUNPRO_C) && !defined(__GNUC__)
9299
#include "port/atomics/generic-sunpro.h"
93-
#elif (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__)
94-
#include "port/atomics/generic-xlc.h"
95100
#else
96101
/*
97102
* Unsupported compiler, we'll likely use slower fallbacks... At least

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy