Commit c1d326be authored by Simon Marlow's avatar Simon Marlow

Always zap the trailing @N from symbols when looking up in a DLL

Fixes win32002(ghci)

Previously we only did this for references from object files, but we
should do it for all symbols, including those that GHCi looks up due
to FFI calls from bytecode.
parent 376fad71
......@@ -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 );
......@@ -1179,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] == '_') {
......@@ -2532,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment