From: David CARLIER Date: Sat, 23 Oct 2021 13:43:42 +0000 (+0100) Subject: BUILD: atomic: fix build on mac/arm64 X-Git-Tag: v2.5-dev12~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c050dc6c689e761af6c2d5a673086a1408164c6a;p=thirdparty%2Fhaproxy.git BUILD: atomic: fix build on mac/arm64 The inline assembly is invalid for this platform thus falling back to the builtin instead. --- diff --git a/include/haproxy/atomic.h b/include/haproxy/atomic.h index ddc809e4f5..4306b75c1e 100644 --- a/include/haproxy/atomic.h +++ b/include/haproxy/atomic.h @@ -698,7 +698,7 @@ __ha_barrier_atomic_full(void) */ #define __ha_cpu_relax() ({ asm volatile("isb" ::: "memory"); 1; }) -#if defined(__ARM_FEATURE_ATOMICS) // ARMv8.1-A atomics +#if defined(__ARM_FEATURE_ATOMICS) && !defined(__clang__) // ARMv8.1-A atomics /* returns 0 on failure, non-zero on success */ static forceinline int __ha_cas_dw(void *target, void *compare, const void *set) @@ -738,7 +738,7 @@ static forceinline int __ha_cas_dw(void *target, void *compare, const void *set) return ret; } -#elif defined(__SIZEOF_INT128__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) // no ARMv8.1-A atomics but 128-bit atomics +#elif defined(__SIZEOF_INT128__) && defined(_ARM_FEATURE_ATOMICS) // 128-bit and ARMv8.1-A will work /* According to https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html * we can use atomics on __int128. The availability of CAS is defined there: