From e9abcad4cc3f9f393e7368c082d693ec6dfc60f5 Mon Sep 17 00:00:00 2001
From: Moritz Angermann <moritz.angermann@gmail.com>
Date: Wed, 22 May 2019 11:19:41 +0800
Subject: [PATCH] No atomics on arm32; this will just yield stubs.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As such the internal linker will fail for them.  The alternative
would be to implement them as stubs in the linker and have them
barf when called.

> Not all operations are supported by all target processors. If a
  particular operation cannot be implemented on the target processor,
  a warning is generated and a call an external function is
  generated. The external function carries the same name as the
  built-in version, with an additional suffix ‘_n’ where n is the size
  of the data type.

(https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html)
---
 libraries/ghc-prim/cbits/atomic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libraries/ghc-prim/cbits/atomic.c b/libraries/ghc-prim/cbits/atomic.c
index a7d7544b4f5..ac2e608ec25 100644
--- a/libraries/ghc-prim/cbits/atomic.c
+++ b/libraries/ghc-prim/cbits/atomic.c
@@ -1,3 +1,4 @@
+#if !defined(arm_HOST_ARCH)
 #include "Rts.h"
 
 // Fallbacks for atomic primops on byte arrays. The builtins used
@@ -418,3 +419,4 @@ hs_atomicwrite64(StgWord x, StgWord64 val)
   while (!__sync_bool_compare_and_swap((StgWord64 *) x, *(StgWord64 *) x, (StgWord64) val));
 #endif
 }
+#endif
-- 
GitLab