<div dir="ltr">Hi Brian,<div><br></div><div>This has been fixed in r314374. You should be able to apply that patch cleanly to 5.0.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 27, 2017 at 6:32 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Brian,<div><br></div><div>Yes - I believe you're correct. I'm working on a fix and extra test coverage now. In the meantime, I believe you should be able to fix the signatures in your copy and everything should "just work".</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Sep 22, 2017 at 2:04 PM, Brian Kahne via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_4928056453454895852m_127642890500541583WordSection1">
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m attempting to port some code which uses the GlobalMappingLayer in the Orc JIT. This code worked fine in LLVM 4, but I’m getting a compile error with LLVM 5. I think the problem is that this layer hasn’t been modified to account for
some of the changes made in LLVM 5, but I wanted to make sure that I wasn’t missing something.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have code which looks like this:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> ModuleHandle addModule(std::unique_ptr<Modu<wbr>le> M) {<u></u><u></u></p>
<p class="MsoNormal"> // Build our symbol resolver:<u></u><u></u></p>
<p class="MsoNormal"> // Lambda 1: Look back into the JIT itself to find symbols that are part of<u></u><u></u></p>
<p class="MsoNormal"> // the same "logical dylib".<u></u><u></u></p>
<p class="MsoNormal"> // Lambda 2: Search for external symbols in the host process.<u></u><u></u></p>
<p class="MsoNormal"> auto Resolver = createLambdaResolver(<u></u><u></u></p>
<p class="MsoNormal"> <wbr> [&](const std::string &Name) {<u></u><u></u></p>
<p class="MsoNormal"> <wbr> if (auto Sym = OptimizeLayer.findSymbol(Name, false))<u></u><u></u></p>
<p class="MsoNormal"> <wbr> return Sym;<u></u><u></u></p>
<p class="MsoNormal"> <wbr> return JITSymbol(nullptr);<u></u><u></u></p>
<p class="MsoNormal"> <wbr> },<u></u><u></u></p>
<p class="MsoNormal"> <wbr> [](const std::string &Name) {<u></u><u></u></p>
<p class="MsoNormal"> <wbr> if (auto SymAddr =<u></u><u></u></p>
<p class="MsoNormal"> <wbr> RTDyldMemoryManager::getSymbol<wbr>AddressInProcess(Name))<u></u><u></u></p>
<p class="MsoNormal"> <wbr> return JITSymbol(SymAddr, JITSymbolFlags::Exported);<u></u><u></u></p>
<p class="MsoNormal"> <wbr> return JITSymbol(nullptr);<u></u><u></u></p>
<p class="MsoNormal"> <wbr> });<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> // Add the set to the JIT with the resolver we created above and a newly<u></u><u></u></p>
<p class="MsoNormal"> // created SectionMemoryManager.<u></u><u></u></p>
<p class="MsoNormal"> return OptimizeLayer.addModule(std::m<wbr>ove(M),<u></u><u></u></p>
<p class="MsoNormal"> <wbr> std::move(Resolver));<u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Where OptimizeLayer is:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> IRTransformLayer<GlobalMapping<wbr>LayerT, OptimizeFunction> OptimizeLayer;<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This worked fine with LLVM 4, but causes a problem in LLVM 5. It looks like the issue is that IRTransformLayer::addModule returns an Expected<ModuleT>, whereas GlobalMappingLayer returns just a ModuleHandleT. However, in LLVM 4, IRTransformLayer::addModuleSet
returned a ModuleSetT and GlobalMappingLayer::addModuleS<wbr>et also returned a ModuleSetHandleT, so the types matched up. In LLVM 5, the CompileOnDemandLayer was changed to return an Expected<ModuleHandleT>, but not GlobalMappingLayer.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Does that explanation seem correct, or am I missing something?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thx,<span class="m_4928056453454895852HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="m_4928056453454895852HOEnZb"><font color="#888888">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-brian<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
<br></div></div>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>