Handle weak_extern in the JIT. This fixes

SingleSource/UnitTests/2007-04-25-weak.c in JIT mode. The test
now passes on systems which are able to produce a correct
reference output to compare with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-01-05 05:32:42 +00:00
parent 1c7a81b0c5
commit 69f9378675
4 changed files with 28 additions and 13 deletions

View File

@ -509,16 +509,17 @@ void *JIT::getPointerToFunction(Function *F) {
<< "' from bitcode file: " << ErrorMsg << "\n";
abort();
}
}
if (void *Addr = getPointerToGlobalIfAvailable(F)) {
return Addr;
// Now retry to get the address.
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr;
}
MutexGuard locked(lock);
if (F->isDeclaration()) {
void *Addr = getPointerToNamedFunction(F->getName());
bool AbortOnFailure = F->getLinkage() != GlobalValue::ExternalWeakLinkage;
void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);
addGlobalMapping(F, Addr);
return Addr;
}