[commit: ghc] ghc-7.8: Link pre-ARMv6 spinlocks into all RTS variants (615d03a)

git at git.haskell.org git at git.haskell.org
Mon Dec 15 14:54:57 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/615d03a4cab16d7818cf6f64aaa9032514b2b36e/ghc

>---------------------------------------------------------------

commit 615d03a4cab16d7818cf6f64aaa9032514b2b36e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Dec 9 18:18:11 2014 -0600

    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
    
    (cherry picked from commit df1307f079ae69dcd735e0973de987b141d509da)


>---------------------------------------------------------------

615d03a4cab16d7818cf6f64aaa9032514b2b36e
 includes/stg/SMP.h |  4 ++--
 rts/OldARMAtomic.c | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index 01663dd..7e39e5a 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -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);
 #endif
 
+#if defined(THREADED_RTS)
+
 /* ----------------------------------------------------------------------------
    Atomic operations
    ------------------------------------------------------------------------- */
diff --git a/rts/OldARMAtomic.c b/rts/OldARMAtomic.c
index b2c52fc..1ca635e 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,6 +55,3 @@ void arm_atomic_spin_unlock()
 } 
 
 #endif  /* arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6) */
-
-#endif  /* defined(THREADED_RTS) */
-



More information about the ghc-commits mailing list