[project @ 2005-03-27 13:41:13 by panne]
[ghc-hetmet.git] / ghc / rts / Linker.c
index 9ee1858..11c1783 100644 (file)
@@ -756,7 +756,7 @@ initLinker( void )
 #   if defined(openbsd_HOST_OS)
     dl_libc_handle = dlopen("libc.so", RTLD_LAZY);
 #   endif
-#   endif // RTLD_DEFAULT
+#   endif /* RTLD_DEFAULT */
 #   endif
 }
 
@@ -803,6 +803,24 @@ addDLL( char *dll_name )
    void *hdl;
    char *errmsg;
 
+   // *** HACK
+   // If we load libHSbase_cbits_dyn.[so|dylib],
+   // then we know that we need to activate another newCAF
+   // related hack in Storage.c because we can't redirect
+   // newCAF to newDynCAF with the system dynamic linker.
+#ifdef OBJFORMAT_MACHO
+   const char *hsbase = "/libHSbase_cbits_dyn.dylib";
+#else
+   const char *hsbase = "/libHSbase_cbits_dyn.so";
+#endif
+   int namelen = strlen(dll_name);
+   int baselen = strlen(hsbase);
+   if(namelen > baselen && !strcmp(dll_name + namelen - baselen, hsbase))
+   {
+      keepCAFs = rtsTrue;
+   }
+   // *** END HACK.
+
    initLinker();
 
    hdl= dlopen(dll_name, RTLD_NOW | RTLD_GLOBAL);
@@ -2181,7 +2199,7 @@ ocResolve_PEi386 ( ObjectCode* oc )
            /* Newline first because the interactive linker has printed "linking..." */
             errorBelch("\n%s: unknown symbol `%s'", oc->fileName, symbol);
             return 0;
-           foundit:
+           foundit:;
          }
          checkProddableBlock(oc, pP);
          switch (reltab_j->Type) {