add a mechanism for the JIT to invoke a function to lazily create functions as they are referenced.
llvm-svn: 43210
diff --git a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
index 61035c2..318d606 100644
--- a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
@@ -101,6 +101,11 @@
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
if (Ptr) return Ptr;
}
+
+ /// If a LazyFunctionCreator is installed, use it to get/create the function.
+ if (LazyFunctionCreator)
+ if (void *RP = LazyFunctionCreator(Name))
+ return RP;
cerr << "ERROR: Program used external function '" << Name
<< "' which could not be resolved!\n";