summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index bbb8085e981..9caf7a0526d 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -813,11 +813,6 @@ template <class ELFT> void Writer<ELFT>::createSections() {
for (Symbol *S : Symtab.getSymbols()) {
SymbolBody *Body = S->body();
- // Set "used" bit for --as-needed.
- if (S->IsUsedInRegularObj && !S->isWeak())
- if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(Body))
- SS->File->IsUsed = true;
-
// We only report undefined symbols in regular objects. This means that we
// will accept an undefined reference in bitcode if it can be optimized out.
if (S->IsUsedInRegularObj && Body->isUndefined() && !S->isWeak())
@@ -834,7 +829,8 @@ template <class ELFT> void Writer<ELFT>::createSections() {
if (isOutputDynamic() && S->includeInDynsym()) {
Out<ELFT>::DynSymTab->addSymbol(Body);
if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(Body))
- Out<ELFT>::VerNeed->addSymbol(SS);
+ if (SS->File->isNeeded())
+ Out<ELFT>::VerNeed->addSymbol(SS);
}
}
OpenPOWER on IntegriCloud