mirror of https://github.com/wolfSSL/wolfssl.git
Modernized memory fence support for C11 and clang
parent
ec6c7051a8
commit
ae939e9e6a
|
@ -1266,8 +1266,13 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#ifndef WOLFSSL_NO_FENCE
|
||||
#ifdef XFENCE
|
||||
/* use user-supplied XFENCE definition. */
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
#include <stdatomic.h>
|
||||
#define XFENCE() atomic_thread_fence(__ATOMIC_SEQ_CST)
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ < 5)
|
||||
#define XFENCE() __sync_synchronize()
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 5)) || defined (__clang__)
|
||||
#define XFENCE() __atomic_thread_fence(__ATOMIC_SEQ_CST)
|
||||
#elif defined (__i386__) || defined(__x86_64__)
|
||||
#define XFENCE() XASM_VOLATILE("lfence")
|
||||
#elif (defined (__arm__) && (__ARM_ARCH > 6)) || defined(__aarch64__)
|
||||
|
|
Loading…
Reference in New Issue