[commit: ghc] ghc-8.0: Linker: Move helpers to #ifdef (9c09d9a)

git at git.haskell.org git at git.haskell.org
Mon Jan 4 16:19:49 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/9c09d9a1b6b255cf8c368195167593f32f3425d4/ghc

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

commit 9c09d9a1b6b255cf8c368195167593f32f3425d4
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Jan 4 16:36:33 2016 +0100

    Linker: Move helpers to #ifdef
    
    Otherwise Clang seems to complain about unused static definitions.


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

9c09d9a1b6b255cf8c368195167593f32f3425d4
 rts/Linker.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index 6561e05..d298179 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -2750,17 +2750,6 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
 #endif
 #endif // NEED_SYMBOL_EXTRAS
 
-// Signed extend a number to a 32-bit int.
-static inline StgInt32 sign_extend32(nat bits, StgWord32 x) {
-  return ((StgInt32) (x << (32 - bits))) >> (32 - bits);
-}
-
-// Does the given signed integer fit into the given bit width?
-static inline StgBool is_int(nat bits, StgInt32 x) {
-  return bits > 32 || (-(1 << (bits-1)) <= x
-                       && x < (1 << (bits-1)));
-}
-
 #if defined(arm_HOST_ARCH)
 
 static void
@@ -4990,6 +4979,21 @@ end:
    return result;
 }
 
+#ifdef arm_HOST_ARCH
+// TODO: These likely belong in a library somewhere
+
+// Signed extend a number to a 32-bit int.
+static inline StgInt32 sign_extend32(nat bits, StgWord32 x) {
+    return ((StgInt32) (x << (32 - bits))) >> (32 - bits);
+}
+
+// Does the given signed integer fit into the given bit width?
+static inline StgBool is_int(nat bits, StgInt32 x) {
+    return bits > 32 || (-(1 << (bits-1)) <= x
+                         && x < (1 << (bits-1)));
+}
+#endif
+
 /* Do ELF relocations which lack an explicit addend.  All x86-linux
    and arm-linux relocations appear to be of this form. */
 static int



More information about the ghc-commits mailing list