libev cvs ECB_MEMORY_FENCE(_RELEASE) undefined

Marc Lehmann schmorp at schmorp.de
Tue Aug 23 17:45:14 CEST 2011


On Tue, Aug 23, 2011 at 04:35:54PM +0200, "common at gmx.ch" <common at gmx.ch> wrote:
> using
> gcc version 4.3.2 (Debian 4.3.2-1.1)
> libev  cvs does not compile as ECB_MEMORY_FENCE and
> ECB_MEMORY_FENCE_RELEASE are not defined

hmm, thanks, thats interesting.

could you investigate why this block doesn't define it on your system? (it's
around line 550 in ev.c):

   #ifndef ECB_MEMORY_FENCE
     #if ECB_GCC_VERSION(2,5)
       #if __x86
         #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
         #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock xchg might be enough */
         #define ECB_MEMORY_FENCE_RELEASE do { } while (0) /* unlikely to change in future cpus */
       #elif __amd64
         #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("mfence" : : : "memory")
         #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("lfence" : : : "memory")
         #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence") /* play safe - not needed in any current cpu */
       #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__
         #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("sync" : : : "memory")
       #elif defined(__ARM_ARCH_6__ ) || defined(__ARM_ARCH_6J__ ) \
          || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__)
         #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory")
       #elif defined(__ARM_ARCH_7__ ) || defined(__ARM_ARCH_7A__ ) \
          || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7R__ )
         #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb" : : : "memory")
       #endif
     #endif
   #endif

Also, there is no really no way it can't be defined, as the block in line
583 defines it in all cases (but might lead to linker errors later).

Can you cvs diff to see if its really the current cvs (there have been no
changes for a few weeks).

> as a quick workaround I commented the uses of them ...

that should actually be safe on most x86/amd64 cpus nowadays.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list