From af4016443146134fc73e5fe8af4094f8a2313cf3 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 29 Apr 2015 01:33:35 +0000 Subject: [PATCH] [Orc] It's not valid to pass a null resolver to addModuleSet. Use a no-op resolver with a diagnostic instread. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236074 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../ExecutionEngine/Orc/IndirectionUtils.h | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h index 7b4f611393f..13ba125e80b 100644 --- a/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h +++ b/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h @@ -15,6 +15,7 @@ #define LLVM_EXECUTIONENGINE_ORC_INDIRECTIONUTILS_H #include "JITSymbol.h" +#include "LambdaResolver.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include "llvm/IR/IRBuilder.h" @@ -159,9 +160,16 @@ private: std::unique_ptr M(new Module("resolver_block_module", Context)); TargetT::insertResolverBlock(*M, *this); + auto NonResolver = + createLambdaResolver( + [](const std::string &Name) -> RuntimeDyld::SymbolInfo { + llvm_unreachable("External symbols in resolver block?"); + }, + [](const std::string &Name) -> RuntimeDyld::SymbolInfo { + llvm_unreachable("Dylib symbols in resolver block?"); + }); auto H = JIT.addModuleSet(SingletonSet(std::move(M)), &MemMgr, - static_cast( - nullptr)); + std::move(NonResolver)); JIT.emitAndFinalize(H); auto ResolverBlockSymbol = JIT.findSymbolIn(H, TargetT::ResolverBlockName, false); @@ -186,9 +194,16 @@ private: TargetT::insertCompileCallbackTrampolines(*M, ResolverBlockAddr, this->NumTrampolinesPerBlock, this->ActiveTrampolines.size()); + auto NonResolver = + createLambdaResolver( + [](const std::string &Name) -> RuntimeDyld::SymbolInfo { + llvm_unreachable("External symbols in trampoline block?"); + }, + [](const std::string &Name) -> RuntimeDyld::SymbolInfo { + llvm_unreachable("Dylib symbols in trampoline block?"); + }); auto H = JIT.addModuleSet(SingletonSet(std::move(M)), &MemMgr, - static_cast( - nullptr)); + std::move(NonResolver)); JIT.emitAndFinalize(H); for (unsigned I = 0; I < this->NumTrampolinesPerBlock; ++I) { std::string Name = GetLabelName(I); -- 2.34.1