Fix an extremely subtle deadlock bug on x86_64
[ghc-hetmet.git] / rts / Linker.c
index 6efca38..e32d324 100644 (file)
@@ -115,6 +115,7 @@ static int ocAllocateSymbolExtras_ELF ( ObjectCode* oc );
 static int ocVerifyImage_PEi386 ( ObjectCode* oc );
 static int ocGetNames_PEi386    ( ObjectCode* oc );
 static int ocResolve_PEi386     ( ObjectCode* oc );
+static void zapTrailingAtSign   ( unsigned char* sym );
 #elif defined(OBJFORMAT_MACHO)
 static int ocVerifyImage_MachO    ( ObjectCode* oc );
 static int ocGetNames_MachO       ( ObjectCode* oc );
@@ -608,6 +609,7 @@ typedef struct _RtsSymbolVal {
       SymI_HasProto(initLinker)                                \
       SymI_HasProto(unpackClosurezh_fast)               \
       SymI_HasProto(getApStackValzh_fast)               \
+      SymI_HasProto(getSparkzh_fast)                    \
       SymI_HasProto(int2Integerzh_fast)                        \
       SymI_HasProto(integer2Intzh_fast)                        \
       SymI_HasProto(integer2Wordzh_fast)               \
@@ -1178,6 +1180,9 @@ lookupSymbol( char *lbl )
 #       elif defined(OBJFORMAT_PEi386)
         OpenedDLL* o_dll;
         void* sym;
+
+        zapTrailingAtSign ( lbl );
+
         for (o_dll = opened_dlls; o_dll != NULL; o_dll = o_dll->next) {
          /* debugBelch("look in %s for %s\n", o_dll->name, lbl); */
            if (lbl[0] == '_') {
@@ -2531,9 +2536,6 @@ ocResolve_PEi386 ( ObjectCode* oc )
             copyName ( sym->Name, strtab, symbol, 1000-1 );
             S = (UInt32) lookupSymbol( symbol );
             if ((void*)S != NULL) goto foundit;
-            zapTrailingAtSign ( symbol );
-            S = (UInt32) lookupSymbol( symbol );
-            if ((void*)S != NULL) goto foundit;
            /* Newline first because the interactive linker has printed "linking..." */
             errorBelch("\n%s: unknown symbol `%s'", oc->fileName, symbol);
             return 0;