Hi,

First part of the patch adds memory fence for aarch64. Strictly, this isn't
necessary, as the fallback to __atomic_thread_fence (__ATOMIC_SEQ_CST)
would output the same dmb ish instruction.

Second part makes sure the ancient arm float format doesn't get used.
Originally I added an if defined(__aarch64__) like the rest, but then I
thought perhaps reversing the the if else makes sense. old arm float format
is so rare, that the default should be native float ordering. By selecting
__arm__ and !( list of features known to identify native endian on arm ),
we don't need to list all the architectures in world that not mixed-endian.
The feature list was picked up from webkit and firefox.

Alternative would be to drop all ancient arm float support - anyone still
using the abi wouldn't be upgrading to new libev.
--- a/ev.c
+++ b/ev.c
@@ -616,6 +616,8 @@
       #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("")
     #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__
       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("sync"     : : : "memory")
+    #elif __aarch64__
+      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb ish"     : : : "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")
@@ -1043,22 +1045,14 @@
 
 /* basically, everything uses "ieee pure-endian" floating point numbers */
 /* the only noteworthy exception is ancient armle, which uses order 43218765 */
-#if 0 \
-    || __i386 || __i386__ \
-    || __amd64 || __amd64__ || __x86_64 || __x86_64__ \
-    || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
-    || defined __arm__ && defined __ARM_EABI__ \
-    || defined __s390__ || defined __s390x__ \
-    || defined __mips__ \
-    || defined __alpha__ \
-    || defined __hppa__ \
-    || defined __ia64__ \
-    || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64
-  #define ECB_STDFP 1
-  #include <string.h> /* for memcpy */
-#else
+#if defined(__arm__) &&  ! (defined(__ARM_EABI__) || defined(__EABI__) \
+    || defined(__VFP_FP__) || defined(_WIN32_WCE) || defined(ANDROID))
   #define ECB_STDFP 0
   #include <math.h> /* for frexp*, ldexp* */
+  #warning "building for ancient arm"
+#else
+  #define ECB_STDFP 1
+  #include <string.h> /* for memcpy */
 #endif
 
 #ifndef ECB_NO_LIBM
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to