Fix problems running the HowToUseJIT on powerpc, and probably problems with
authorChris Lattner <sabre@nondot.org>
Sun, 20 Feb 2005 18:43:35 +0000 (18:43 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 20 Feb 2005 18:43:35 +0000 (18:43 +0000)
ANY program that does not have all functions internalized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20258 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JITEmitter.cpp

index 7f6a89ed4858bd02a2f47f02938b9f3915dce96c..85ce67b9a9c81d8c3a97fba8218eed8193c68939 100644 (file)
@@ -180,14 +180,14 @@ void *JITResolver::getFunctionStub(Function *F) {
   // Call the lazy resolver function unless we already KNOW it is an external
   // function, in which case we just skip the lazy resolution step.
   void *Actual = (void*)LazyResolverFn;
-  if (F->hasExternalLinkage())
+  if (F->isExternal() && F->hasExternalLinkage())
     Actual = TheJIT->getPointerToFunction(F);
     
   // Otherwise, codegen a new stub.  For now, the stub will call the lazy
   // resolver function.
   Stub = TheJIT->getJITInfo().emitFunctionStub(Actual, MCE);
 
-  if (F->hasExternalLinkage()) {
+  if (Actual != (void*)LazyResolverFn) {
     // If we are getting the stub for an external function, we really want the
     // address of the stub in the GlobalAddressMap for the JIT, not the address
     // of the external function.