From bda337a8d84bb0738cec4ec613e40d8381895401 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 27 Oct 2017 22:54:16 +0000 Subject: [PATCH] Rename isInCurrentDSO -> isInCurrentOutput. DSO is short for dynamic shared object, so the function name was a little confusing because it sounded like it didn't work when we were a creating statically-linked executable or something. What we mean by "DSO" here is the current output file that we are creating. Thus the new name. Alternatively, we could call it the current ELF module, but "module" is a overloaded word, so I avoided that. llvm-svn: 316809 --- lld/ELF/MarkLive.cpp | 2 +- lld/ELF/SymbolTable.cpp | 12 ++++++------ lld/ELF/Symbols.cpp | 6 +++--- lld/ELF/Symbols.h | 2 +- lld/ELF/SyntheticSections.cpp | 6 +++--- lld/ELF/Writer.cpp | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index f85896c..b585f7e 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.isInCurrentDSO()) + if (!B.isInCurrentOutput()) for (InputSectionBase *Sec : CNamedSections.lookup(B.getName())) Fn(Sec, 0); } diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index e0952f8..7f7e6b2 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -210,7 +210,7 @@ void SymbolTable::applySymbolRenames() { Symbol *Real = &Origs[I]; // If __real_foo was undefined, we don't want it in the symbol table. - if (!Real->body()->isInCurrentDSO()) + if (!Real->body()->isInCurrentOutput()) continue; auto *NewSym = make(); @@ -324,7 +324,7 @@ Symbol *SymbolTable::addUndefined(StringRef Name, bool IsLocal, uint8_t Binding, } if (Binding != STB_WEAK) { SymbolBody *B = S->body(); - if (!B->isInCurrentDSO()) + if (!B->isInCurrentOutput()) S->Binding = Binding; if (auto *SS = dyn_cast(B)) SS->getFile()->IsUsed = true; @@ -364,7 +364,7 @@ static int compareDefined(Symbol *S, bool WasInserted, uint8_t Binding, if (WasInserted) return 1; SymbolBody *Body = S->body(); - if (!Body->isInCurrentDSO()) + if (!Body->isInCurrentOutput()) return 1; if (int R = compareVersion(S, Name)) @@ -659,7 +659,7 @@ StringMap> &SymbolTable::getDemangledSyms() { DemangledSyms.emplace(); for (Symbol *Sym : SymVector) { SymbolBody *B = Sym->body(); - if (!B->isInCurrentDSO()) + if (!B->isInCurrentOutput()) continue; if (Optional S = demangle(B->getName())) (*DemangledSyms)[*S].push_back(B); @@ -674,7 +674,7 @@ std::vector SymbolTable::findByVersion(SymbolVersion Ver) { if (Ver.IsExternCpp) return getDemangledSyms().lookup(Ver.Name); if (SymbolBody *B = find(Ver.Name)) - if (B->isInCurrentDSO()) + if (B->isInCurrentOutput()) return {B}; return {}; } @@ -692,7 +692,7 @@ std::vector SymbolTable::findAllByVersion(SymbolVersion Ver) { for (Symbol *Sym : SymVector) { SymbolBody *B = Sym->body(); - if (B->isInCurrentDSO() && M.match(B->getName())) + if (B->isInCurrentOutput() && M.match(B->getName())) Res.push_back(B); } return Res; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index ba42794..6af89e4 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -228,7 +228,7 @@ void SymbolBody::parseSymbolVersion() { Name = {S.data(), Pos}; // If this is not in this DSO, it is not a definition. - if (!isInCurrentDSO()) + if (!isInCurrentOutput()) return; // '@@' in a symbol name means the default version. @@ -330,7 +330,7 @@ uint8_t Symbol::computeBinding() const { return Binding; if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) return STB_LOCAL; - if (VersionId == VER_NDX_LOCAL && body()->isInCurrentDSO()) + if (VersionId == VER_NDX_LOCAL && body()->isInCurrentOutput()) return STB_LOCAL; if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE) return STB_GLOBAL; @@ -342,7 +342,7 @@ bool Symbol::includeInDynsym() const { return false; if (computeBinding() == STB_LOCAL) return false; - if (!body()->isInCurrentDSO()) + if (!body()->isInCurrentOutput()) return true; return ExportDynamic; } diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 5d1a242..a988989 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -69,7 +69,7 @@ public: return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind; } - bool isInCurrentDSO() const { + bool isInCurrentOutput() const { return SymbolKind == DefinedRegularKind || SymbolKind == DefinedCommonKind; } diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 544ee70..c458f2d 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1124,10 +1124,10 @@ template void DynamicSection::finalizeContents() { } if (SymbolBody *B = Symtab->find(Config->Init)) - if (B->isInCurrentDSO()) + if (B->isInCurrentOutput()) add({DT_INIT, B}); if (SymbolBody *B = Symtab->find(Config->Fini)) - if (B->isInCurrentDSO()) + if (B->isInCurrentOutput()) add({DT_FINI, B}); bool HasVerNeed = In::VerNeed->getNeedNum() != 0; @@ -1794,7 +1794,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.Symbol)) return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr; - return !S.Symbol->isInCurrentDSO(); + return !S.Symbol->isInCurrentOutput(); }); if (Mid == V.end()) return; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index d991059..8b12673 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -749,7 +749,7 @@ static DefinedRegular * addOptionalRegular(StringRef Name, SectionBase *Sec, uint64_t Val, uint8_t StOther = STV_HIDDEN, uint8_t Binding = STB_GLOBAL) { SymbolBody *S = Symtab->find(Name); - if (!S || S->isInCurrentDSO()) + if (!S || S->isInCurrentOutput()) return nullptr; Symbol *Sym = Symtab->addRegular(Name, StOther, STT_NOTYPE, Val, /*Size=*/0, Binding, Sec, @@ -1223,7 +1223,7 @@ static bool computeIsPreemptible(const SymbolBody &B) { // At this point copy relocations have not been created yet, so any // symbol that is not defined locally is preemptible. - if (!B.isInCurrentDSO()) + if (!B.isInCurrentOutput()) return true; // If we have a dynamic list it specifies which local symbols are preemptible. -- 2.7.4