Template Haskell: improve lifting for strings
[ghc-hetmet.git] / rts / Linker.c
index 4ee28d6..d41ede6 100644 (file)
@@ -26,7 +26,7 @@
 #include "RtsUtils.h"
 #include "Schedule.h"
 #include "Sparks.h"
-#include "RtsTypeable.h"
+#include "RtsGlobals.h"
 #include "Timer.h"
 #include "Trace.h"
 
@@ -205,7 +205,7 @@ static void machoInitSymbolsWithoutUnderscore( void );
 #define MMAP_32BIT_BASE_DEFAULT 0x40000000
 #endif
 
-static void *mmap_32bit_base = MMAP_32BIT_BASE_DEFAULT;
+static void *mmap_32bit_base = (void *)MMAP_32BIT_BASE_DEFAULT;
 #endif
 
 /* MAP_ANONYMOUS is MAP_ANON on some systems, e.g. OpenBSD */
@@ -609,6 +609,7 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(barf)                              \
       SymI_HasProto(debugBelch)                                \
       SymI_HasProto(errorBelch)                                \
+      SymI_HasProto(sysErrorBelch)                      \
       SymI_HasProto(asyncExceptionsBlockedzh_fast)     \
       SymI_HasProto(blockAsyncExceptionszh_fast)       \
       SymI_HasProto(catchzh_fast)                      \
@@ -639,6 +640,7 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(freeHaskellFunctionPtr)            \
       SymI_HasProto(freeStablePtr)                     \
       SymI_HasProto(getOrSetTypeableStore)             \
+      SymI_HasProto(getOrSetSignalHandlerStore)                \
       SymI_HasProto(gcdIntegerzh_fast)                 \
       SymI_HasProto(gcdIntegerIntzh_fast)              \
       SymI_HasProto(gcdIntzh_fast)                     \
@@ -1053,6 +1055,16 @@ initLinker( void )
         mmap_32bit_base = (void*)RtsFlags.MiscFlags.linkerMemBase;
     }
 #endif
+
+#if defined(mingw32_HOST_OS)
+    /*
+     * These two libraries cause problems when added to the static link,
+     * but are necessary for resolving symbols in GHCi, hence we load
+     * them manually here.
+     */
+    addDLL("msvcrt");
+    addDLL("kernel32");
+#endif
 }
 
 /* -----------------------------------------------------------------------------
@@ -4097,7 +4109,9 @@ static int relocateSection(
         
         char    *thingPtr = image + sect->offset + reloc->r_address;
         uint64_t thing;
-        uint64_t value;
+        /* We shouldn't need to initialise this, but gcc on OS X 64 bit
+           complains that it may be used uninitialized if we don't */
+        uint64_t value = 0;
         uint64_t baseValue;
         int type = reloc->r_type;