From 280ff742c50246e374db2ad2e41aabee8c85cc7a Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 7 Nov 2013 18:56:17 -0700 Subject: [PATCH] fix for mingw gcc V3 build --- src/libCom/osi/compiler/gcc/epicsAtomicCD.h | 28 ++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h index 055d8be52..949def6d0 100644 --- a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h @@ -55,14 +55,14 @@ extern "C" { * in all version four gcc invarient of target. The gnu doc * seems to say that when not supported by architecture a call * to an external function is generated but in practice - * this isnt the case for some of the atomic intrinsics, and + * this isn`t the case for some of the atomic intrinsics, and * so there is an undefined symbol. So far we have not seen * that with __sync_synchronize, but we can only guess based * on experimental evidence. * * For example we know that when generating object code for - * 386 most of the atomic instrinsics are not present and - * we see undefined symbols with mingw, but we dont have + * 386 most of the atomic intrinsics are not present and + * we see undefined symbols with mingw, but we don`t have * troubles with __sync_synchronize. */ #if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER @@ -83,6 +83,28 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () } #endif +#else + +#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER +#ifdef GCC_ATOMIC_INTRINSICS_MIN_X86 +#define EPICS_ATOMIC_READ_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +{ + asm("mfence;"); +} +#endif +#endif + +#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER +#ifdef GCC_ATOMIC_INTRINSICS_MIN_X86 +#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +{ + asm("mfence;"); +} +#endif +#endif + #endif /* if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER */ #if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T \