Commit df1307f0 authored by Joachim Breitner's avatar Joachim Breitner Committed by Austin Seipp
Browse files

Link pre-ARMv6 spinlocks into all RTS variants

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

Test Plan: It helped here.

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #8951
parent 8b480d31
......@@ -14,13 +14,13 @@
#ifndef SMP_H
#define SMP_H
#if defined(THREADED_RTS)
#if arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6)
void arm_atomic_spin_lock(void);
void arm_atomic_spin_unlock(void);
#if defined(THREADED_RTS)
/* ----------------------------------------------------------------------------
Atomic operations
------------------------------------------------------------------------- */
......@@ -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>
#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) */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment