<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 13, 2017 at 7:47 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Rui Ueyama via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
> +// Returns true if this is a weak undefined symbol.<br>
>  bool SymbolBody::isUndefWeak() const {<br>
> -  if (isLocal())<br>
> -    return false;<br>
> -  return symbol()->isWeak() && (isUndefined() || isLazy());<br>
> +  // A note on isLazy() in the following expression: If you add a weak<br>
> +  // undefined symbol and then a lazy symbol to the symbol table, the<br>
> +  // combined result is a lazy weak symbol. isLazy is for that sitaution.<br>
<br>
</span>The same is true in the other order (first lazy then undef weak).<br>
<span class=""><br>
> +  // Weak undefined symbols shouldn't fetch archive members (for<br>
> +  // compatibility with other linkers), but we still want to memorize<br>
> +  // that there are lazy symbols, because strong undefined symbols<br>
> +  // could be added later which triggers archive member fetching.<br>
> +  // Thus, the weak lazy symbol is a valid concept in lld.<br>
> +  return !isLocal() && symbol()->isWeak() && (isUndefined() || isLazy());<br>
<br>
</span>This comment is now duplicated with the one in<br>
SymbolTable::addLazyArchive. Any thoughts on merging the two?<br></blockquote><div><br></div><div>Maybe we can move the comment to Symbols.h to describe the semantics of the lazy and undefined symbols. </div></div></div></div>