[lld] r259889 - Rename IsUsedInDynamicReloc to MustBeInDynSym.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 07:27:16 PST 2016


Author: rafael
Date: Fri Feb  5 09:27:15 2016
New Revision: 259889

URL: http://llvm.org/viewvc/llvm-project?rev=259889&view=rev
Log:
Rename IsUsedInDynamicReloc to MustBeInDynSym.

The variable was marking various cases where a symbol must be included
in the dynamic symbol table. Being used by a dynamic relocation was only
one of them.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/SymbolTable.cpp
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=259889&r1=259888&r2=259889&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Feb  5 09:27:15 2016
@@ -219,7 +219,7 @@ template <class ELFT>
 void RelocationSection<ELFT>::addReloc(const DynamicReloc<ELFT> &Reloc) {
   SymbolBody *Sym = Reloc.Sym;
   if (!Reloc.UseSymVA && Sym)
-    Sym->setUsedInDynamicReloc();
+    Sym->MustBeInDynSym = true;
   Relocs.push_back(Reloc);
 }
 

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=259889&r1=259888&r2=259889&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Feb  5 09:27:15 2016
@@ -268,7 +268,7 @@ template <class ELFT> void SymbolTable<E
     for (StringRef U : File->getUndefinedSymbols())
       if (SymbolBody *Sym = find(U))
         if (Sym->isDefined())
-          Sym->setUsedInDynamicReloc();
+          Sym->MustBeInDynSym = true;
 }
 
 template class elf2::SymbolTable<ELF32LE>;

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=259889&r1=259888&r2=259889&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Fri Feb  5 09:27:15 2016
@@ -128,7 +128,7 @@ template <class ELFT> int SymbolBody::co
   // symbols in the DSO at runtime.
   if (isShared() != Other->isShared())
     if (isa<DefinedRegular<ELFT>>(isShared() ? Other : this))
-      IsUsedInDynamicReloc = Other->IsUsedInDynamicReloc = true;
+      MustBeInDynSym = Other->MustBeInDynSym = true;
 
   if (L != R)
     return -1;

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=259889&r1=259888&r2=259889&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Fri Feb  5 09:27:15 2016
@@ -83,8 +83,6 @@ public:
   bool isLazy() const { return SymbolKind == LazyKind; }
   bool isShared() const { return SymbolKind == SharedKind; }
   bool isUsedInRegularObj() const { return IsUsedInRegularObj; }
-  bool isUsedInDynamicReloc() const { return IsUsedInDynamicReloc; }
-  void setUsedInDynamicReloc() { IsUsedInDynamicReloc = true; }
   bool isTls() const { return IsTls; }
   bool isFunc() const { return IsFunc; }
 
@@ -131,10 +129,9 @@ public:
 protected:
   SymbolBody(Kind K, StringRef Name, bool IsWeak, uint8_t Visibility,
              bool IsTls, bool IsFunc)
-      : SymbolKind(K), IsWeak(IsWeak), Visibility(Visibility), IsTls(IsTls),
-        IsFunc(IsFunc), Name(Name) {
+      : SymbolKind(K), IsWeak(IsWeak), Visibility(Visibility),
+        MustBeInDynSym(false), IsTls(IsTls), IsFunc(IsFunc), Name(Name) {
     IsUsedInRegularObj = K != SharedKind && K != LazyKind;
-    IsUsedInDynamicReloc = 0;
   }
 
   const unsigned SymbolKind : 8;
@@ -147,9 +144,11 @@ protected:
   // it can be false.
   unsigned IsUsedInRegularObj : 1;
 
+public:
   // If true, the symbol is added to .dynsym symbol table.
-  unsigned IsUsedInDynamicReloc : 1;
+  unsigned MustBeInDynSym : 1;
 
+protected:
   unsigned IsTls : 1;
   unsigned IsFunc : 1;
   StringRef Name;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259889&r1=259888&r2=259889&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Feb  5 09:27:15 2016
@@ -366,8 +366,7 @@ void Writer<ELFT>::scanRelocs(
         // See "Global Offset Table" in Chapter 5 in the following document
         // for detailed description:
         // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
-        // FIXME: Why do we need to set this here?
-        Body->setUsedInDynamicReloc();
+        Body->MustBeInDynSym = true;
         continue;
       }
 
@@ -778,7 +777,7 @@ static bool includeInDynsym(const Symbol
     return false;
   if (Config->ExportDynamic || Config->Shared)
     return true;
-  return B.isUsedInDynamicReloc();
+  return B.MustBeInDynSym;
 }
 
 // This class knows how to create an output section for a given




More information about the llvm-commits mailing list