libev on sparc v8 leon

Marc Lehmann schmorp at
Wed Nov 20 16:36:34 CET 2013

On Wed, Nov 20, 2013 at 06:30:30PM +0400, Alexey Privalov <a_privalov at> wrote:
> I've tried to compile libev on sparc v8 len and got an issue:
> ev.c:1531:31: warning: 'ev_default_loop_ptr' initialized and declared 'extern' [enabled by default]
> /tmp/cc58REb2.s: Assembler messages:
> /tmp/cc58REb2.s:1037: Error: Architecture mismatch on "membar".
> /tmp/cc58REb2.s:1037: (Requires v9|v9a|v9b; requested architecture is v8.)
> are any ideas how to resolve this problem?

Yes. Please send a patch for ecb.h that implements the correct memory
barriers for sparcv8, and the compiler symbols to test for it. You are
currently running into this section in ev.c, which tests for __sparc and
then uses membar insns, which is obviously wrong for your arch:

    #elif __sparc || __sparc__
      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory")
      #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad"                            : : : "memory")
      #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore             | #StoreStore")

Less useful (for us) would be to comment out the above #elif section
and rely on your compiler (any C11 compiler will do. gcc 4.4+ has the
necessary support and libev will pick that up automatically).

Alternatively, if your program is non-threaded, OR the systems your
programs will run on are single-cpu/core systems, you can simply switch
off memory barriers by compiling with -DECB_NO_SMP, which will simply disable
the use of memory barriers, as they are unnecessary.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list