ELF: Remove function Symbol::isInCurrentOutput().
authorPeter Collingbourne <peter@pcc.me.uk>
Mon, 6 Nov 2017 04:39:07 +0000 (04:39 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Mon, 6 Nov 2017 04:39:07 +0000 (04:39 +0000)
This function is now equivalent to isDefined().

llvm-svn: 317449

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 c639198..3520abe 100644 (file)
@@ -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);
 }
index 6e2f151..84e115a 100644 (file)
@@ -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(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<SharedSymbol>(S))
       SS->getFile<ELFT>()->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<std::vector<Symbol *>> &SymbolTable::getDemangledSyms() {
   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::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<Symbol *> 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;
 }
index 523a82a..70c510c 100644 (file)
@@ -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;
 }
index 8475646..a8ee09a 100644 (file)
@@ -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;
index a37ad2f..0cced1f 100644 (file)
@@ -1102,10 +1102,10 @@ template <class ELFT> void DynamicSection<ELFT>::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<ELFT>::VerNeed->getNeedNum() != 0;
@@ -1774,7 +1774,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.Sym))
           return SS->CopyRelSec == nullptr && !SS->NeedsPltAddr;
-        return !S.Sym->isInCurrentOutput();
+        return !S.Sym->isDefined();
       });
   if (Mid == V.end())
     return;
index 3785ed2..607c5dc 100644 (file)
@@ -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<ELFT>(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.