[lld] r310079 - Remove redundant flag.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 10:43:54 PDT 2017


Author: rafael
Date: Fri Aug  4 10:43:54 2017
New Revision: 310079

URL: http://llvm.org/viewvc/llvm-project?rev=310079&view=rev
Log:
Remove redundant flag.

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=310079&r1=310078&r2=310079&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri Aug  4 10:43:54 2017
@@ -526,7 +526,6 @@ template <class ELFT> static void addCop
   // dynamic symbol for each one. This causes the copy relocation to correctly
   // interpose any aliases.
   for (SharedSymbol *Sym : getSymbolsAt<ELFT>(SS)) {
-    Sym->NeedsCopy = true;
     Sym->CopyRelSec = Sec;
     Sym->CopyRelSecOff = Off;
     Sym->symbol()->IsUsedInRegularObj = true;
@@ -579,7 +578,7 @@ static RelExpr adjustExpr(SymbolBody &Bo
   if (Body.isObject()) {
     // Produce a copy relocation.
     auto *B = cast<SharedSymbol>(&Body);
-    if (!B->NeedsCopy) {
+    if (!B->CopyRelSec) {
       if (Config->ZNocopyreloc)
         error("unresolvable relocation " + toString(Type) +
               " against symbol '" + toString(*B) +

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=310079&r1=310078&r2=310079&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Fri Aug  4 10:43:54 2017
@@ -106,7 +106,7 @@ static uint64_t getSymVA(const SymbolBod
            cast<DefinedCommon>(Body).Offset;
   case SymbolBody::SharedKind: {
     auto &SS = cast<SharedSymbol>(Body);
-    if (SS.NeedsCopy)
+    if (SS.CopyRelSec)
       return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff +
              SS.CopyRelSecOff;
     if (SS.NeedsPltAddr)
@@ -125,7 +125,7 @@ static uint64_t getSymVA(const SymbolBod
 
 SymbolBody::SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
                        uint8_t Type)
-    : SymbolKind(K), NeedsCopy(false), NeedsPltAddr(false), IsLocal(IsLocal),
+    : SymbolKind(K), NeedsPltAddr(false), IsLocal(IsLocal),
       IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
       IsInIgot(false), Type(Type), StOther(StOther), Name(Name) {}
 
@@ -138,8 +138,8 @@ bool SymbolBody::isPreemptible() const {
   // Shared symbols resolve to the definition in the DSO. The exceptions are
   // symbols with copy relocations (which resolve to .bss) or preempt plt
   // entries (which resolve to that plt entry).
-  if (isShared())
-    return !NeedsCopy && !NeedsPltAddr;
+  if (auto *SS = dyn_cast<SharedSymbol>(this))
+    return !SS->CopyRelSec && !NeedsPltAddr;
 
   // Only symbols that appear in dynsym can be preempted.
   if (!symbol()->includeInDynsym())
@@ -220,7 +220,7 @@ OutputSection *SymbolBody::getOutputSect
   }
 
   if (auto *S = dyn_cast<SharedSymbol>(this)) {
-    if (S->NeedsCopy)
+    if (S->CopyRelSec)
       return S->CopyRelSec->getParent();
     return nullptr;
   }

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=310079&r1=310078&r2=310079&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Fri Aug  4 10:43:54 2017
@@ -104,10 +104,6 @@ protected:
   const unsigned SymbolKind : 8;
 
 public:
-  // True if the linker has to generate a copy relocation.
-  // For SharedSymbol only.
-  unsigned NeedsCopy : 1;
-
   // True the symbol should point to its PLT entry.
   // For SharedSymbol only.
   unsigned NeedsPltAddr : 1;




More information about the llvm-commits mailing list