summaryrefslogtreecommitdiff
path: root/rts/OldARMAtomic.c
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2014-12-09 18:18:11 -0600
committerAustin Seipp <austin@well-typed.com>2014-12-09 19:59:27 -0600
commitdf1307f079ae69dcd735e0973de987b141d509da (patch)
treeb8335df94c75e12078ebfc7b05f1eff897a84854 /rts/OldARMAtomic.c
parent8b480d3192e6eff6183934d7bbcc2054611c3651 (diff)
downloadhaskell-df1307f079ae69dcd735e0973de987b141d509da.tar.gz
Link pre-ARMv6 spinlocks into all RTS variants
Summary: For compatibility with ARM machines from pre v6, the RTS provides implementations of certain atomic operations. Previously, these were only included in the threaded RTS. But ghc (the library) contains the code in compiler/cbits/genSym.c, which uses these operations if there is more than one capability. But there is only one libHSghc, so the linker wants to resolve these symbols in every case. By providing these operations in all RTSs, the linker is happy. The only downside is a small amount of dead code in the non-threaded RTS on old ARM machines. Test Plan: It helped here. Reviewers: bgamari, austin Reviewed By: bgamari, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D564 GHC Trac Issues: #8951
Diffstat (limited to 'rts/OldARMAtomic.c')
-rw-r--r--rts/OldARMAtomic.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rts/OldARMAtomic.c b/rts/OldARMAtomic.c
index a28d2bc00e..3c60e6d669 100644
--- a/rts/OldARMAtomic.c
+++ b/rts/OldARMAtomic.c
@@ -5,6 +5,12 @@
* Inefficient but necessary atomic locks used for implementing atomic
* operations on ARM architectures pre-ARMv6.
*
+ * These operations are not only referenced in the threaded RTS, but also in
+ * ghc (the library), via the operations in compiler/cbits/genSym.c.
+ * They are not actually called in a non-threaded environment, but we still
+ * need them in every RTS to make the linker happy, hence no
+ * #if defined(THREADED_RTS) here. See #8951.
+ *
* -------------------------------------------------------------------------- */
#include "PosixSource.h"
@@ -14,8 +20,6 @@
#include <sched.h>
#endif
-#if defined(THREADED_RTS)
-
#if arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6)
static volatile int atomic_spin = 0;
@@ -51,5 +55,3 @@ void arm_atomic_spin_unlock()
}
#endif /* arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6) */
-
-#endif /* defined(THREADED_RTS) */