File aarch64-support.patch of Package cimple

Index: cimple-2.0.24/config.guess
===================================================================
--- cimple-2.0.24.orig/config.guess
+++ cimple-2.0.24/config.guess
@@ -38,6 +38,10 @@ if [ -z "$host" ]; then
       host=ppc-unknown-linux-gnu
       ;;
 
+    aarch64:Linux:*:*)
+      host=aarch64-unknown-linux-gnu
+      ;;
+
     sun4*:SunOS:*:*)
       host=sparc-sun-solaris-gnu
       ;;
Index: cimple-2.0.24/configure
===================================================================
--- cimple-2.0.24.orig/configure
+++ cimple-2.0.24/configure
@@ -282,6 +282,11 @@ case "$host" in
         libbase=lib64
         ;;
 
+    aarch64-unknown-linux-gnu)
+        platform=LINUX_AARCH64_GNU
+        libbase=lib64
+        ;;
+
     arm-wrs-vxworks-gnu)
         platform=VXWORKS_XSCALE_GNU
         libbase=lib
Index: cimple-2.0.24/mak/platform_LINUX_AARCH64_GNU.mak
===================================================================
--- /dev/null
+++ cimple-2.0.24/mak/platform_LINUX_AARCH64_GNU.mak
@@ -0,0 +1 @@
+include $(TOP)/mak/platform_LINUX.mak
Index: cimple-2.0.24/src/cimple/Atomic.h
===================================================================
--- cimple-2.0.24.orig/src/cimple/Atomic.h
+++ cimple-2.0.24/src/cimple/Atomic.h
@@ -41,6 +41,8 @@
 #elif defined(CIMPLE_PLATFORM_LINUX_S390_GNU) || \
     defined(CIMPLE_PLATFORM_LINUX_S390X_GNU)
 # include "Atomic_LINUX_S390_GNU.h"
+#elif defined(CIMPLE_PLATFORM_LINUX_AARCH64_GNU)
+# include "Atomic_LINUX_AARCH64_GNU.h"
 #elif defined(CIMPLE_PLATFORM_DARWIN_PPC_GNU)
 # include "Atomic_DARWIN_PPC_GNU.h"
 #elif defined(CIMPLE_PLATFORM_DARWIN_IX86_GNU)
Index: cimple-2.0.24/src/cimple/Atomic_LINUX_AARCH64_GNU.h
===================================================================
--- /dev/null
+++ cimple-2.0.24/src/cimple/Atomic_LINUX_AARCH64_GNU.h
@@ -0,0 +1,53 @@
+#ifndef _cimple_Atomic_LINUX_AARCH64_GNU_h
+#define _cimple_Atomic_LINUX_AARCH64_GNU_h
+
+#include "config.h"
+
+#define CIMPLE_ATOMIC_INITIALIZER { 0 }
+
+CIMPLE_NAMESPACE_BEGIN
+
+struct Atomic
+{
+    int n;
+};
+
+inline void Atomic_create(Atomic* atomic, int x)
+{
+    atomic->n = x;
+}
+
+inline void Atomic_destroy(Atomic* atomic)
+{
+}
+
+inline int Atomic_get(const Atomic* atomic)
+{
+    int value;
+    __atomic_load (&atomic->n, &value, __ATOMIC_SEQ_CST);
+    return value;
+}
+
+inline void Atomic_set(Atomic* atomic, int x)
+{
+    __atomic_store (&atomic->n, &x, __ATOMIC_SEQ_CST);
+}
+
+static __inline__ void Atomic_inc(Atomic* atomic)
+{
+    __atomic_add_fetch(&atomic->n, 1, __ATOMIC_SEQ_CST);
+}
+
+static __inline__ int Atomic_dec_and_test(Atomic* atomic)
+{
+    return __atomic_add_fetch(&atomic->n, -1, __ATOMIC_SEQ_CST) == 0;
+}
+
+static __inline__ void Atomic_dec(Atomic* atomic)
+{
+    __atomic_add_fetch(&atomic->n, -1, __ATOMIC_SEQ_CST);
+}
+
+CIMPLE_NAMESPACE_END
+
+#endif /* _cimple_Atomic_LINUX_IX86_GNU_h */
Index: cimple-2.0.24/src/cimple/config.h
===================================================================
--- cimple-2.0.24.orig/src/cimple/config.h
+++ cimple-2.0.24/src/cimple/config.h
@@ -55,6 +55,8 @@
 #elif defined(CIMPLE_PLATFORM_LINUX_S390_GNU) || \
     defined(CIMPLE_PLATFORM_LINUX_S390X_GNU)
 # include "platform_LINUX_S390_GNU.h"
+#elif defined(CIMPLE_PLATFORM_LINUX_AARCH64_GNU)
+# include "platform_LINUX_AARCH64_GNU.h"
 #elif defined(CIMPLE_PLATFORM_WIN32_IX86_MSVC)
 # include "platform_WIN32_IX86_MSVC.h"
 #elif defined(CIMPLE_PLATFORM_WIN64_X86_64_MSVC)
Index: cimple-2.0.24/src/cimple/platform_LINUX_AARCH64_GNU.h
===================================================================
--- /dev/null
+++ cimple-2.0.24/src/cimple/platform_LINUX_AARCH64_GNU.h
@@ -0,0 +1,10 @@
+#ifndef _cimple_platform_LINUX_AARCH64_GNU_h
+#define _cimple_platform_LINUX_AARCH64_GNU_h
+
+#include "platform_LINUX.h"
+
+#define CIMPLE_LITTLE_ENDIAN
+
+#define CIMPLE_PLATFORM_ID "LINUX_AARCH64_GNU"
+
+#endif /* _cimple_platform_LINUX_AARCH64_GNU_h */
openSUSE Build Service is sponsored by