Rename isInCurrentDSO -> isInCurrentOutput.
authorRui Ueyama <ruiu@google.com>
Fri, 27 Oct 2017 22:54:16 +0000 (22:54 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 27 Oct 2017 22:54:16 +0000 (22:54 +0000)
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
lld/ELF/SymbolTable.cpp
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/SyntheticSections.cpp
lld/ELF/Writer.cpp

index f85896c..b585f7e 100644 (file)
@@ -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);
 }
index e0952f8..7f7e6b2 100644 (file)
@@ -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<Symbol>();
@@ -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<SharedSymbol>(B))
       SS->getFile<ELFT>()->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<std::vector<SymbolBody *>> &SymbolTable::getDemangledSyms() {
     DemangledSyms.emplace();
     for (Symbol *Sym : SymVector) {
       SymbolBody *B = Sym->body();
-      if (!B->isInCurrentDSO())
+      if (!B->isInCurrentOutput())
         continue;
       if (Optional<std::string> S = demangle(B->getName()))
         (*DemangledSyms)[*S].push_back(B);
@@ -674,7 +674,7 @@ std::vector<SymbolBody *> 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<SymbolBody *> 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;
index ba42794..6af89e4 100644 (file)
@@ -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;
 }
index 5d1a242..a988989 100644 (file)
@@ -69,7 +69,7 @@ public:
     return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind;
   }
 
-  bool isInCurrentDSO() const {
+  bool isInCurrentOutput() const {
     return SymbolKind == DefinedRegularKind || SymbolKind == DefinedCommonKind;
   }
 
index 544ee70..c458f2d 100644 (file)
@@ -1124,10 +1124,10 @@ template <class ELFT> void DynamicSection<ELFT>::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<ELFT>::VerNeed->getNeedNum() != 0;
@@ -1794,7 +1794,7 @@ void GnuHashTableSection::addSymbols(std::vector<SymbolTableEntry> &V) {
         // linker has to look them up, so they have to be in the hash table.
         if (auto *SS = dyn_cast<SharedSymbol>(S.Symbol))
           return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr;
-        return !S.Symbol->isInCurrentDSO();
+        return !S.Symbol->isInCurrentOutput();
       });
   if (Mid == V.end())
     return;
index d991059..8b12673 100644 (file)
@@ -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<ELFT>(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.