llvm.org GIT mirror llvm / 67faeed
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270899 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 3 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7070 // Lambda 2: Search for external symbols in the host process.
7171 auto Resolver = createLambdaResolver(
7272 [&](const std::string &Name) {
73 if (auto Sym = CompileLayer.findSymbol(Name, false))
73 if (auto Sym = OptimizeLayer.findSymbol(Name, false))
7474 return RuntimeDyld::SymbolInfo(Sym.getAddress(), Sym.getFlags());
7575 return RuntimeDyld::SymbolInfo(nullptr);
7676 },