[lld] r315664 - Add comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 13:48:35 PDT 2017


On Fri, Oct 13, 2017 at 7:47 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:
>
> > +// Returns true if this is a weak undefined symbol.
> >  bool SymbolBody::isUndefWeak() const {
> > -  if (isLocal())
> > -    return false;
> > -  return symbol()->isWeak() && (isUndefined() || isLazy());
> > +  // A note on isLazy() in the following expression: If you add a weak
> > +  // undefined symbol and then a lazy symbol to the symbol table, the
> > +  // combined result is a lazy weak symbol. isLazy is for that
> sitaution.
>
> The same is true in the other order (first lazy then undef weak).
>
> > +  // Weak undefined symbols shouldn't fetch archive members (for
> > +  // compatibility with other linkers), but we still want to memorize
> > +  // that there are lazy symbols, because strong undefined symbols
> > +  // could be added later which triggers archive member fetching.
> > +  // Thus, the weak lazy symbol is a valid concept in lld.
> > +  return !isLocal() && symbol()->isWeak() && (isUndefined() ||
> isLazy());
>
> This comment is now duplicated with the one in
> SymbolTable::addLazyArchive. Any thoughts on merging the two?
>

Maybe we can move the comment to Symbols.h to describe the semantics of the
lazy and undefined symbols.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171015/92d19235/attachment.html>


More information about the llvm-commits mailing list