[project @ 2005-05-10 10:27:20 by simonmar]
[ghc-hetmet.git] / ghc / rts / Linker.c
index d49c814..11e111a 100644 (file)
@@ -296,7 +296,8 @@ typedef struct _RtsSymbolVal {
       SymX(log)                                 \
       SymX(sqrt)                                \
       SymX(memcpy)                              \
-      SymX(stg_InstallConsoleEvent)             \
+      SymX(rts_InstallConsoleEvent)             \
+      SymX(rts_ConsoleHandlerDone)              \
       Sym(mktime)                               \
       Sym(_imp___timezone)                      \
       Sym(_imp___tzname)                        \
@@ -317,6 +318,14 @@ typedef struct _RtsSymbolVal {
 # define MAIN_CAP_SYM
 #endif
 
+#if !defined(mingw32_HOST_OS)
+#define RTS_USER_SIGNALS_SYMBOLS \
+   SymX(startSignalHandler) \
+   SymX(setIOManagerPipe)
+#else
+#define RTS_USER_SIGNALS_SYMBOLS /* nothing */
+#endif
+
 #ifdef TABLES_NEXT_TO_CODE
 #define RTS_RET_SYMBOLS /* nothing */
 #else
@@ -522,9 +531,7 @@ typedef struct _RtsSymbolVal {
       SymX(run_queue_hd)                       \
       SymX(__hscore_get_saved_termios)         \
       SymX(__hscore_set_saved_termios)         \
-      SymX(setIOManagerPipe)                   \
       SymX(setProgArgv)                                \
-      SymX(startSignalHandler)                 \
       SymX(startupHaskell)                     \
       SymX(shutdownHaskell)                    \
       SymX(shutdownHaskellAndExit)             \
@@ -592,7 +599,8 @@ typedef struct _RtsSymbolVal {
       SymX(word2Integerzh_fast)                        \
       SymX(writeTVarzh_fast)                   \
       SymX(xorIntegerzh_fast)                  \
-      SymX(yieldzh_fast)
+      SymX(yieldzh_fast)                        \
+      RTS_USER_SIGNALS_SYMBOLS
 
 #ifdef SUPPORT_LONG_LONGS
 #define RTS_LONG_LONG_SYMS                     \
@@ -1955,6 +1963,7 @@ ocGetNames_PEi386 ( ObjectCode* oc )
 #     endif
 
       if (0==strcmp(".text",sectab_i->Name) ||
+          0==strcmp(".rdata",sectab_i->Name)||
           0==strcmp(".rodata",sectab_i->Name))
          kind = SECTIONKIND_CODE_OR_RODATA;
       if (0==strcmp(".data",sectab_i->Name) ||
@@ -1974,7 +1983,7 @@ ocGetNames_PEi386 ( ObjectCode* oc )
           && 0 != strcmp(".stab", sectab_i->Name)
           && 0 != strcmp(".stabstr", sectab_i->Name)
          ) {
-         errorBelch("Unknown PEi386 section name `%s'", sectab_i->Name);
+         errorBelch("Unknown PEi386 section name `%s' (while processing: %s)", sectab_i->Name, oc->fileName);
          return 0;
       }
 
@@ -2213,9 +2222,15 @@ ocResolve_PEi386 ( ObjectCode* oc )
                   -- hence the constant 4.
                   Also I don't know if A should be added, but so
                   far it has always been zero.
+
+                 SOF 05/2005: 'A' (old contents of *pP) have been observed
+                 to contain values other than zero (the 'wx' object file
+                 that came with wxhaskell-0.9.4; dunno how it was compiled..).
+                 So, add displacement to old value instead of asserting
+                 A to be zero. Fixes wxhaskell-related crashes, and no other
+                 ill effects have been observed.
               */
-               ASSERT(A==0);
-               *pP = S - ((UInt32)pP) - 4;
+               *pP = S - ((UInt32)pP) - 4 + A;
                break;
             default:
                debugBelch("%s: unhandled PEi386 relocation type %d",