diff options
author | Lang Hames <lhames@gmail.com> | 2014-08-14 02:38:20 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2014-08-14 02:38:20 +0000 |
commit | ea800ca586633c03c113142055ef21f38bbf569c (patch) | |
tree | e455d1fcf17aa155176dcdb17e8e373b0557f0d7 /llvm/lib | |
parent | 8c913ecd154da964b7988ecb5a436afac818fe30 (diff) | |
download | bcm5719-llvm-ea800ca586633c03c113142055ef21f38bbf569c.tar.gz bcm5719-llvm-ea800ca586633c03c113142055ef21f38bbf569c.zip |
[MCJIT] Support DisableSymbolSearching and InstallLazyFunctionCreator in MCJIT.
Patch by Anthony Pesch. Thanks Anthony!
llvm-svn: 215613
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 53630d5a5e8..c60f366f8b8 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -316,13 +316,19 @@ uint64_t MCJIT::getSymbolAddress(const std::string &Name, // If it hasn't already been generated, see if it's in one of our modules. Module *M = findModuleForSymbol(Name, CheckFunctionsOnly); - if (!M) - return 0; + if (M) { + generateCodeForModule(M); + + // Check the RuntimeDyld table again, it should be there now. + return getExistingSymbolAddress(Name); + } - generateCodeForModule(M); + // If a LazyFunctionCreator is installed, use it to get/create the function. + // FIXME: Should we instead have a LazySymbolCreator callback? + if (LazyFunctionCreator) + Addr = (uint64_t)LazyFunctionCreator(Name); - // Check the RuntimeDyld table again, it should be there now. - return getExistingSymbolAddress(Name); + return Addr; } uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) { @@ -578,5 +584,7 @@ uint64_t LinkingMemoryManager::getSymbolAddress(const std::string &Name) { Result = ParentEngine->getSymbolAddress(Name.substr(1), false); if (Result) return Result; + if (ParentEngine->isSymbolSearchingDisabled()) + return 0; return ClientMM->getSymbolAddress(Name); } |