diff options
author | Dan Gohman <gohman@apple.com> | 2009-01-05 05:32:42 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-01-05 05:32:42 +0000 |
commit | 69f9378675b23135043d93aa58300fed3ec41cbf (patch) | |
tree | 81d5c99a3387d8c274c61443fae54f8e8006d6dc /lib/ExecutionEngine/JIT/Intercept.cpp | |
parent | 1c7a81b0c5cbc982755e1a4dca9d1726f3f5c1c0 (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/Intercept.cpp')
-rw-r--r-- | lib/ExecutionEngine/JIT/Intercept.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/JIT/Intercept.cpp b/lib/ExecutionEngine/JIT/Intercept.cpp index af8b58ed4d..1590925b04 100644 --- a/lib/ExecutionEngine/JIT/Intercept.cpp +++ b/lib/ExecutionEngine/JIT/Intercept.cpp @@ -90,7 +90,8 @@ static int jit_atexit(void (*Fn)(void)) { /// function by using the dynamic loader interface. As such it is only useful /// for resolving library symbols, not code generated symbols. /// -void *JIT::getPointerToNamedFunction(const std::string &Name) { +void *JIT::getPointerToNamedFunction(const std::string &Name, + bool AbortOnFailure) { if (!isSymbolSearchingDisabled()) { // Check to see if this is one of the functions we want to intercept. Note, // we cast to intptr_t here to silence a -pedantic warning that complains @@ -122,9 +123,9 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) { // First try turning $LDBLStub into $LDBL128. If that fails, strip it off. // This mirrors logic in libSystemStubs.a. std::string Prefix = std::string(Name.begin(), Name.end()-9); - if (void *Ptr = getPointerToNamedFunction(Prefix+"$LDBL128")) + if (void *Ptr = getPointerToNamedFunction(Prefix+"$LDBL128"), false) return Ptr; - if (void *Ptr = getPointerToNamedFunction(Prefix)) + if (void *Ptr = getPointerToNamedFunction(Prefix), false) return Ptr; } #endif @@ -135,8 +136,10 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) { if (void *RP = LazyFunctionCreator(Name)) return RP; - cerr << "ERROR: Program used external function '" << Name - << "' which could not be resolved!\n"; - abort(); + if (AbortOnFailure) { + cerr << "ERROR: Program used external function '" << Name + << "' which could not be resolved!\n"; + abort(); + } return 0; } |