[Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.
Symbol resolution should be done on the top layer of the stack unless there's a good reason to do otherwise. In this case it would have worked because OptimizeLayer::addModuleSet eagerly passes all modules down to the CompileLayer, meaning that searches in CompileLayer will find the definitions. In later chapters where the top layer's addModuleSet isn't a pass-through, this would break. llvm-svn: 270899
This commit is contained in:
parent
da0b9a959e
commit
4a59a34597
|
@ -71,7 +71,7 @@ public:
|
|||
// Lambda 2: Search for external symbols in the host process.
|
||||
auto Resolver = createLambdaResolver(
|
||||
[&](const std::string &Name) {
|
||||
if (auto Sym = CompileLayer.findSymbol(Name, false))
|
||||
if (auto Sym = OptimizeLayer.findSymbol(Name, false))
|
||||
return RuntimeDyld::SymbolInfo(Sym.getAddress(), Sym.getFlags());
|
||||
return RuntimeDyld::SymbolInfo(nullptr);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue