[lld] r317449 - ELF: Remove function Symbol::isInCurrentOutput().
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 5 20:39:07 PST 2017
Author: pcc
Date: Sun Nov 5 20:39:07 2017
New Revision: 317449
URL: http://llvm.org/viewvc/llvm-project?rev=317449&view=rev
Log:
ELF: Remove function Symbol::isInCurrentOutput().
This function is now equivalent to isDefined().
Modified:
lld/trunk/ELF/MarkLive.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Sun Nov 5 20:39:07 2017
@@ -74,7 +74,7 @@ static void resolveReloc(InputSectionBas
return;
}
- if (!B.isInCurrentOutput())
+ if (!B.isDefined())
for (InputSectionBase *Sec : CNamedSections.lookup(B.getName()))
Fn(Sec, 0);
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sun Nov 5 20:39:07 2017
@@ -185,7 +185,7 @@ void SymbolTable::applySymbolWrap() {
for (WrappedSymbol &W : WrappedSymbols) {
// First, make a copy of __real_sym.
Symbol *Real = nullptr;
- if (W.Real->isInCurrentOutput()) {
+ if (W.Real->isDefined()) {
Real = (Symbol *)make<SymbolUnion>();
memcpy(Real, W.Real, sizeof(SymbolUnion));
}
@@ -305,7 +305,7 @@ Symbol *SymbolTable::addUndefined(String
return S;
}
if (Binding != STB_WEAK) {
- if (!S->isInCurrentOutput())
+ if (!S->isDefined())
S->Binding = Binding;
if (auto *SS = dyn_cast<SharedSymbol>(S))
SS->getFile<ELFT>()->IsUsed = true;
@@ -344,7 +344,7 @@ static int compareDefined(Symbol *S, boo
StringRef Name) {
if (WasInserted)
return 1;
- if (!S->isInCurrentOutput())
+ if (!S->isDefined())
return 1;
if (int R = compareVersion(S, Name))
return R;
@@ -633,7 +633,7 @@ StringMap<std::vector<Symbol *>> &Symbol
if (!DemangledSyms) {
DemangledSyms.emplace();
for (Symbol *Sym : SymVector) {
- if (!Sym->isInCurrentOutput())
+ if (!Sym->isDefined())
continue;
if (Optional<std::string> S = demangle(Sym->getName()))
(*DemangledSyms)[*S].push_back(Sym);
@@ -648,7 +648,7 @@ std::vector<Symbol *> SymbolTable::findB
if (Ver.IsExternCpp)
return getDemangledSyms().lookup(Ver.Name);
if (Symbol *B = find(Ver.Name))
- if (B->isInCurrentOutput())
+ if (B->isDefined())
return {B};
return {};
}
@@ -665,7 +665,7 @@ std::vector<Symbol *> SymbolTable::findA
}
for (Symbol *Sym : SymVector)
- if (Sym->isInCurrentOutput() && M.match(Sym->getName()))
+ if (Sym->isDefined() && M.match(Sym->getName()))
Res.push_back(Sym);
return Res;
}
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Sun Nov 5 20:39:07 2017
@@ -218,7 +218,7 @@ void Symbol::parseSymbolVersion() {
Name = {S.data(), Pos};
// If this is not in this DSO, it is not a definition.
- if (!isInCurrentOutput())
+ if (!isDefined())
return;
// '@@' in a symbol name means the default version.
@@ -289,7 +289,7 @@ uint8_t Symbol::computeBinding() const {
return Binding;
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL;
- if (VersionId == VER_NDX_LOCAL && isInCurrentOutput())
+ if (VersionId == VER_NDX_LOCAL && isDefined())
return STB_LOCAL;
if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE)
return STB_GLOBAL;
@@ -301,7 +301,7 @@ bool Symbol::includeInDynsym() const {
return false;
if (computeBinding() == STB_LOCAL)
return false;
- if (!isInCurrentOutput())
+ if (!isDefined())
return true;
return ExportDynamic;
}
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Sun Nov 5 20:39:07 2017
@@ -101,8 +101,6 @@ public:
return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind;
}
- bool isInCurrentOutput() const { return isDefined(); }
-
// True is this is an undefined weak symbol. This only works once
// all input files have been added.
bool isUndefWeak() const;
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Sun Nov 5 20:39:07 2017
@@ -1102,10 +1102,10 @@ template <class ELFT> void DynamicSectio
}
if (Symbol *B = Symtab->find(Config->Init))
- if (B->isInCurrentOutput())
+ if (B->isDefined())
add({DT_INIT, B});
if (Symbol *B = Symtab->find(Config->Fini))
- if (B->isInCurrentOutput())
+ if (B->isDefined())
add({DT_FINI, B});
bool HasVerNeed = In<ELFT>::VerNeed->getNeedNum() != 0;
@@ -1774,7 +1774,7 @@ void GnuHashTableSection::addSymbols(std
// linker has to look them up, so they have to be in the hash table.
if (auto *SS = dyn_cast<SharedSymbol>(S.Sym))
return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr;
- return !S.Sym->isInCurrentOutput();
+ return !S.Sym->isDefined();
});
if (Mid == V.end())
return;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=317449&r1=317448&r2=317449&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sun Nov 5 20:39:07 2017
@@ -738,7 +738,7 @@ static Defined *addOptionalRegular(Strin
uint64_t Val, uint8_t StOther = STV_HIDDEN,
uint8_t Binding = STB_GLOBAL) {
Symbol *S = Symtab->find(Name);
- if (!S || S->isInCurrentOutput())
+ if (!S || S->isDefined())
return nullptr;
Symbol *Sym = Symtab->addRegular<ELFT>(Name, StOther, STT_NOTYPE, Val,
/*Size=*/0, Binding, Sec,
@@ -1191,7 +1191,7 @@ static bool computeIsPreemptible(const S
// At this point copy relocations have not been created yet, so any
// symbol that is not defined locally is preemptible.
- if (!B.isInCurrentOutput())
+ if (!B.isDefined())
return true;
// If we have a dynamic list it specifies which local symbols are preemptible.
More information about the llvm-commits
mailing list