aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-01-05 05:32:42 +0000
committerDan Gohman <gohman@apple.com>2009-01-05 05:32:42 +0000
commit69f9378675b23135043d93aa58300fed3ec41cbf (patch)
tree81d5c99a3387d8c274c61443fae54f8e8006d6dc /lib/ExecutionEngine/JIT/JIT.cpp
parent1c7a81b0c5cbc982755e1a4dca9d1726f3f5c1c0 (diff)
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
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 5d5ecc4fe7..6cd1c50978 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -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;
}