diff options
| author | Lang Hames <lhames@gmail.com> | 2018-07-02 22:30:18 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2018-07-02 22:30:18 +0000 |
| commit | adae9bfa243713a781ecad6e07759e57dc2c7f52 (patch) | |
| tree | 22a5695b8cf1a1ecc028edcdccc66fd173895afa /llvm/tools | |
| parent | 9f02a94dad81f6f2adb775a1b34c9c30e2b9887f (diff) | |
| download | bcm5719-llvm-adae9bfa243713a781ecad6e07759e57dc2c7f52.tar.gz bcm5719-llvm-adae9bfa243713a781ecad6e07759e57dc2c7f52.zip | |
[ORC] Verify modules when running LLLazyJIT in LLI, and deal with fallout.
The verifier identified several modules that were broken due to incorrect
linkage on declarations. To fix this, CompileOnDemandLayer2::extractFunction
has been updated to change decls to external linkage.
llvm-svn: 336150
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/lli/lli.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index b7c821bb585..74ab2f3cd5a 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -35,6 +35,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" #include "llvm/IR/TypeBuilder.h" +#include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" @@ -767,7 +768,16 @@ int runOrcLazyJIT(LLVMContext &Ctx, std::vector<std::unique_ptr<Module>> Ms, auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(ES), std::move(TM), DL, Ctx)); - J->setLazyCompileTransform(createDebugDumper()); + auto Dump = createDebugDumper(); + + J->setLazyCompileTransform( + [&](std::unique_ptr<Module> M) { + if (verifyModule(*M, &dbgs())) { + dbgs() << "Bad module: " << *M << "\n"; + exit(1); + } + return Dump(std::move(M)); + }); J->getMainVSO().setFallbackDefinitionGenerator( orc::DynamicLibraryFallbackGenerator( std::move(LibLLI), DL, [](orc::SymbolStringPtr) { return true; })); @@ -776,8 +786,10 @@ int runOrcLazyJIT(LLVMContext &Ctx, std::vector<std::unique_ptr<Module>> Ms, orc::LocalCXXRuntimeOverrides2 CXXRuntimeOverrides; ExitOnErr(CXXRuntimeOverrides.enable(J->getMainVSO(), Mangle)); - for (auto &M : Ms) + for (auto &M : Ms) { + orc::makeAllSymbolsExternallyAccessible(*M); ExitOnErr(J->addLazyIRModule(std::move(M))); + } ExitOnErr(J->runConstructors()); |

