[lld] r315664 - Add comment.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 19:57:59 PDT 2017
Author: ruiu
Date: Thu Oct 12 19:57:59 2017
New Revision: 315664
URL: http://llvm.org/viewvc/llvm-project?rev=315664&view=rev
Log:
Add comment.
Modified:
lld/trunk/ELF/Symbols.cpp
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=315664&r1=315663&r2=315664&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Oct 12 19:57:59 2017
@@ -126,10 +126,18 @@ SymbolBody::SymbolBody(Kind K, StringRef
IsInIgot(false), IsPreemptible(false), Type(Type), StOther(StOther),
Name(Name) {}
+// 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.
+ //
+ // 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());
}
InputFile *SymbolBody::getFile() const {
More information about the llvm-commits
mailing list