Clang doesn't consider the currently declared function as the proper intrinsic function (a few parameters differ vaguely), and even if declared properly, clang requires building for a target with the cx16 flag enabled to be able to use that intrinsic.
Instead just use the inline assembly or GCC builtin version instead.
This fixes building in PE mode with Clang in MSVC mode for both x86_64 and aarch64.
Signed-off-by: Martin Storsjo martin@martin.st --- include/winnt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/winnt.h b/include/winnt.h index 04353d9405d..9d797a85099 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6894,7 +6894,7 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask)
#ifdef _WIN64
-#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__)
#define InterlockedCompareExchange128 _InterlockedCompareExchange128 static inline unsigned char _InterlockedCompareExchange128(__int64 *dest, __int64 xchg_high, __int64 xchg_low, __int64 *compare); @@ -6913,7 +6913,7 @@ static inline unsigned char InterlockedCompareExchange128(__int64 *dest, __int64 return ret; }
-#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__clang__)
static inline unsigned char InterlockedCompareExchange128(__int64 *dest, __int64 xchg_high, __int64 xchg_low, __int64 *compare) {