summaryrefslogtreecommitdiff
path: root/ELF/SymbolTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/SymbolTable.cpp')
-rw-r--r--ELF/SymbolTable.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/ELF/SymbolTable.cpp b/ELF/SymbolTable.cpp
index b6bf219988632..c3a00bea4aaa7 100644
--- a/ELF/SymbolTable.cpp
+++ b/ELF/SymbolTable.cpp
@@ -491,12 +491,13 @@ void SymbolTable::addShared(StringRef Name, SharedFile<ELFT> &File,
if (WasInserted || ((S->isUndefined() || S->isLazy()) &&
S->getVisibility() == STV_DEFAULT)) {
uint8_t Binding = S->Binding;
+ bool WasUndefined = S->isUndefined();
replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
Sym.getType(), Sym.st_value, Sym.st_size,
Alignment, VerdefIndex);
if (!WasInserted) {
S->Binding = Binding;
- if (!S->isWeak() && !Config->GcSections)
+ if (!S->isWeak() && !Config->GcSections && WasUndefined)
File.IsNeeded = true;
}
}