From db367e952e8198706ab73ffc5f7bd7ba3e8164c8 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 23 Oct 2018 20:54:43 +0000 Subject: Revert r345077 "[ORC] Change how non-exported symbols are matched during lookup." Doesn't build on Windows. The call to 'lookup' is ambiguous. Clang and MSVC agree, anyway. http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/787 C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): error C2668: 'llvm::orc::ExecutionSession::lookup': ambiguous call to overloaded function C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(823): note: could be 'llvm::Expected llvm::orc::ExecutionSession::lookup(llvm::ArrayRef,llvm::orc::SymbolStringPtr)' C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(817): note: or 'llvm::Expected llvm::orc::ExecutionSession::lookup(const llvm::orc::JITDylibSearchList &,llvm::orc::SymbolStringPtr)' C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): note: while trying to match the argument list '(initializer list, llvm::orc::SymbolStringPtr)' llvm-svn: 345078 --- llvm/tools/lli/lli.cpp | 46 +++++++--------------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) (limited to 'llvm/tools') diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index c3c57e2cdee..f4585dc080d 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -115,11 +115,6 @@ namespace { "rather than individual functions"), cl::init(false)); - cl::list - JITDylibs("jd", - cl::desc("Specifies the JITDylib to be used for any subsequent " - "-extra-module arguments.")); - // The MCJIT supports building for a target address space separate from // the JIT compilation process. Use a forked process and a copying // memory manager with IPC to execute using this functionality. @@ -754,8 +749,6 @@ static orc::IRTransformLayer::TransformFunction createDebugDumper() { llvm_unreachable("Unknown DumpKind"); } -static void exitOnLazyCallThroughFailure() { exit(1); } - int runOrcLazyJIT(const char *ProgName) { // Start setting up the JIT environment. @@ -785,11 +778,7 @@ int runOrcLazyJIT(const char *ProgName) { : None); DataLayout DL = ExitOnErr(JTMB.getDefaultDataLayoutForTarget()); - - auto J = ExitOnErr(orc::LLLazyJIT::Create( - std::move(JTMB), DL, - pointerToJITTargetAddress(exitOnLazyCallThroughFailure), - LazyJITCompileThreads)); + auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(JTMB), DL, LazyJITCompileThreads)); if (PerModuleLazy) J->setPartitionFunction(orc::CompileOnDemandLayer::compileWholeModule); @@ -814,32 +803,13 @@ int runOrcLazyJIT(const char *ProgName) { // Add the main module. ExitOnErr(J->addLazyIRModule(std::move(MainModule))); - // Create JITDylibs and add any extra modules. - { - // Create JITDylibs, keep a map from argument index to dylib. We will use - // -extra-module argument indexes to determine what dylib to use for each - // -extra-module. - std::map IdxToDylib; - IdxToDylib[0] = &J->getMainJITDylib(); - for (auto JDItr = JITDylibs.begin(), JDEnd = JITDylibs.end(); - JDItr != JDEnd; ++JDItr) { - IdxToDylib[JITDylibs.getPosition(JDItr - JITDylibs.begin())] = - &J->createJITDylib(*JDItr); - } + // Add any extra modules. + for (auto &ModulePath : ExtraModules) { + auto M = parseIRFile(ModulePath, Err, *TSCtx.getContext()); + if (!M) + reportError(Err, ProgName); - for (auto EMItr = ExtraModules.begin(), EMEnd = ExtraModules.end(); - EMItr != EMEnd; ++EMItr) { - auto M = parseIRFile(*EMItr, Err, *TSCtx.getContext()); - if (!M) - reportError(Err, ProgName); - - auto EMIdx = ExtraModules.getPosition(EMItr - ExtraModules.begin()); - assert(EMIdx != 0 && "ExtraModule should have index > 0"); - auto JDItr = std::prev(IdxToDylib.lower_bound(EMIdx)); - auto &JD = *JDItr->second; - ExitOnErr( - J->addLazyIRModule(JD, orc::ThreadSafeModule(std::move(M), TSCtx))); - } + ExitOnErr(J->addLazyIRModule(orc::ThreadSafeModule(std::move(M), TSCtx))); } // Add the objects. @@ -867,8 +837,6 @@ int runOrcLazyJIT(const char *ProgName) { AltEntryThreads.push_back(std::thread([EntryPoint]() { EntryPoint(); })); } - J->getExecutionSession().dump(llvm::dbgs()); - // Run main. auto MainSym = ExitOnErr(J->lookup("main")); typedef int (*MainFnPtr)(int, const char *[]); -- cgit v1.2.3