[llvm-dev] Lazily Loaded Modules and Linker::LinkOnlyNeeded

Rafael EspĂ­ndola via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 21 08:06:32 PDT 2016


>
> So in that case linkIfNeeded will return false since you have LinkOnlyNeeded and there is no declaration in the dest module (it isn't needed by the dest module). I'm not completely sure what should happen here with LinkOnlyNeeded. There is handling in the IRMover to lazily add references to link that are encountered when copying over bodies, however, this only happens when the reference value is LinkOnce (since it could be discarded in the source module). It may be that in the case LinkOnlyNeeded is designed for this functionality wasn't needed - it was specific to a special situation in linking CUDA, see http://reviews.llvm.org/D12459. I'm guessing to handle your case you would want to change ModuleLinker::addLazyFor() to be more aggressive in the LinkOnlyNeeded case.


Yes, that was the problem.

Fixed in r266995. Neil, can you give that a try?

Cheers,
Rafael


More information about the llvm-dev mailing list