[commit: ghc] master: Linker: Move helpers to #ifdef (7e599f5)

git at git.haskell.org git at git.haskell.org
Mon Jan 4 16:18:58 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7e599f53e12e97a7e043919cd0d8b96f11bb18c0/ghc

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

commit 7e599f53e12e97a7e043919cd0d8b96f11bb18c0
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.


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

7e599f53e12e97a7e043919cd0d8b96f11bb18c0
 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