[lld] r315664 - Add comment.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 07:47:04 PDT 2017


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?

Cheers,
Rafael


More information about the llvm-commits mailing list