]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: atomic: fix build on mac/arm64
authorDavid CARLIER <devnexen@gmail.com>
Sat, 23 Oct 2021 13:43:42 +0000 (14:43 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Oct 2021 07:45:48 +0000 (09:45 +0200)
The inline assembly is invalid for this platform thus falling back
to the builtin instead.

include/haproxy/atomic.h

index ddc809e4f5681cf61f26e46599634e1364c948c1..4306b75c1e4fb9a61d80644d93e1c7a97e72c4cd 100644 (file)
@@ -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: