diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-12-17 21:35:29 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-12-17 21:35:29 +0000 |
commit | 2b73a4e90f6b83fb5bece3f846321ebee1c89bf7 (patch) | |
tree | 5d8307036b6b783d2dcbf53bc60a3191adeb0bb3 /llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | |
parent | 7cc86b4cc63ccb0d3117255a3b9b724c7f86f40f (diff) | |
download | bcm5719-llvm-2b73a4e90f6b83fb5bece3f846321ebee1c89bf7.tar.gz bcm5719-llvm-2b73a4e90f6b83fb5bece3f846321ebee1c89bf7.zip |
Don't codegen available_externally functions. Fixes http://llvm.org/PR5735.
llvm-svn: 91626
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index a670772b06d..e3523ff80fe 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -517,9 +517,15 @@ void *JITResolver::getLazyFunctionStub(Function *F) { void *Actual = TheJIT->isCompilingLazily() ? (void *)(intptr_t)LazyResolverFn : (void *)0; + // TODO: Delete this when PR5737 is fixed. + std::string ErrorMsg; + if (TheJIT->materializeFunction(F, &ErrorMsg)) { + llvm_report_error("Error reading function '" + F->getName()+ + "' from bitcode file: " + ErrorMsg); + } // If this is an external declaration, attempt to resolve the address now // to place in the stub. - if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) { + if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) { Actual = TheJIT->getPointerToFunction(F); // If we resolved the symbol to a null address (eg. a weak external) @@ -552,7 +558,7 @@ void *JITResolver::getLazyFunctionStub(Function *F) { // exist yet, add it to the JIT's work list so that we can fill in the stub // address later. if (!Actual && !TheJIT->isCompilingLazily()) - if (!F->isDeclaration() || F->hasNotBeenReadFromBitcode()) + if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage()) TheJIT->addPendingFunction(F); return Stub; @@ -755,9 +761,16 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference, void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F); if (ResultPtr) return ResultPtr; + // TODO: Delete this when PR5737 is fixed. + std::string ErrorMsg; + if (TheJIT->materializeFunction(F, &ErrorMsg)) { + llvm_report_error("Error reading function '" + F->getName()+ + "' from bitcode file: " + ErrorMsg); + } + // If this is an external function pointer, we can force the JIT to // 'compile' it, which really just adds it to the map. - if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) + if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) return TheJIT->getPointerToFunction(F); } @@ -1562,6 +1575,7 @@ void JIT::updateFunctionStub(Function *F) { JITEmitter *JE = cast<JITEmitter>(getCodeEmitter()); void *Stub = JE->getJITResolver().getLazyFunctionStub(F); void *Addr = getPointerToGlobalIfAvailable(F); + assert(Addr != Stub && "Function must have non-stub address to be updated."); // Tell the target jit info to rewrite the stub at the specified address, // rather than creating a new one. |