From: Peter Collingbourne Date: Mon, 6 Nov 2017 04:39:07 +0000 (+0000) Subject: ELF: Remove function Symbol::isInCurrentOutput(). X-Git-Tag: llvmorg-6.0.0-rc1~4101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b472aa02689962991f619f0717fbeade36b21443;p=platform%2Fupstream%2Fllvm.git ELF: Remove function Symbol::isInCurrentOutput(). This function is now equivalent to isDefined(). llvm-svn: 317449 --- diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index c639198..3520abe 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -74,7 +74,7 @@ static void resolveReloc(InputSectionBase &Sec, RelT &Rel, return; } - if (!B.isInCurrentOutput()) + if (!B.isDefined()) for (InputSectionBase *Sec : CNamedSections.lookup(B.getName())) Fn(Sec, 0); } diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 6e2f151..84e115a 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -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(); memcpy(Real, W.Real, sizeof(SymbolUnion)); } @@ -305,7 +305,7 @@ Symbol *SymbolTable::addUndefined(StringRef Name, bool IsLocal, uint8_t Binding, return S; } if (Binding != STB_WEAK) { - if (!S->isInCurrentOutput()) + if (!S->isDefined()) S->Binding = Binding; if (auto *SS = dyn_cast(S)) SS->getFile()->IsUsed = true; @@ -344,7 +344,7 @@ static int compareDefined(Symbol *S, bool WasInserted, uint8_t Binding, 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> &SymbolTable::getDemangledSyms() { if (!DemangledSyms) { DemangledSyms.emplace(); for (Symbol *Sym : SymVector) { - if (!Sym->isInCurrentOutput()) + if (!Sym->isDefined()) continue; if (Optional S = demangle(Sym->getName())) (*DemangledSyms)[*S].push_back(Sym); @@ -648,7 +648,7 @@ std::vector SymbolTable::findByVersion(SymbolVersion Ver) { 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 SymbolTable::findAllByVersion(SymbolVersion Ver) { } for (Symbol *Sym : SymVector) - if (Sym->isInCurrentOutput() && M.match(Sym->getName())) + if (Sym->isDefined() && M.match(Sym->getName())) Res.push_back(Sym); return Res; } diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 523a82a..70c510c 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -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; } diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 8475646..a8ee09a 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -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; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index a37ad2f..0cced1f 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1102,10 +1102,10 @@ template void DynamicSection::finalizeContents() { } 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::VerNeed->getNeedNum() != 0; @@ -1774,7 +1774,7 @@ void GnuHashTableSection::addSymbols(std::vector &V) { // linker has to look them up, so they have to be in the hash table. if (auto *SS = dyn_cast(S.Sym)) return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr; - return !S.Sym->isInCurrentOutput(); + return !S.Sym->isDefined(); }); if (Mid == V.end()) return; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3785ed2..607c5dc 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -738,7 +738,7 @@ static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec, 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(Name, StOther, STT_NOTYPE, Val, /*Size=*/0, Binding, Sec, @@ -1191,7 +1191,7 @@ static bool computeIsPreemptible(const Symbol &B) { // 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.