[Orc] It's not valid to pass a null resolver to addModuleSet. Use a no-op
authorLang Hames <lhames@gmail.com>
Wed, 29 Apr 2015 01:33:35 +0000 (01:33 +0000)
committerLang Hames <lhames@gmail.com>
Wed, 29 Apr 2015 01:33:35 +0000 (01:33 +0000)
resolver with a diagnostic instread.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236074 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/Orc/IndirectionUtils.h

index 7b4f611393f449ab69d443e4c4399fb7e92db78d..13ba125e80b4b627b84350451e89b673238b148d 100644 (file)
@@ -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<Module> 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<RuntimeDyld::SymbolResolver*>(
-                                  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<RuntimeDyld::SymbolResolver*>(
-                                  nullptr));
+                              std::move(NonResolver));
     JIT.emitAndFinalize(H);
     for (unsigned I = 0; I < this->NumTrampolinesPerBlock; ++I) {
       std::string Name = GetLabelName(I);