[lld] r295288 - Removes a trivial accessor.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 22:12:41 PST 2017


Author: ruiu
Date: Thu Feb 16 00:12:41 2017
New Revision: 295288

URL: http://llvm.org/viewvc/llvm-project?rev=295288&view=rev
Log:
Removes a trivial accessor.

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

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=295288&r1=295287&r2=295288&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Feb 16 00:12:41 2017
@@ -457,8 +457,8 @@ template <class ELFT> static void addCop
   // dynamic symbol for each one. This causes the copy relocation to correctly
   // interpose any aliases.
   for (SharedSymbol<ELFT> *Alias : getAliases(SS)) {
-    Alias->CopySection = ISec;
     Alias->NeedsCopy = true;
+    Alias->Section = ISec;
     Alias->symbol()->IsUsedInRegularObj = true;
   }
 

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=295288&r1=295287&r2=295288&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Feb 16 00:12:41 2017
@@ -79,10 +79,8 @@ static typename ELFT::uint getSymVA(cons
            cast<DefinedCommon>(Body).Offset;
   case SymbolBody::SharedKind: {
     auto &SS = cast<SharedSymbol<ELFT>>(Body);
-    if (SS.NeedsCopy) {
-      InputSection<ELFT> *ISec = SS.getBssSectionForCopy();
-      return ISec->OutSec->Addr + ISec->OutSecOff;
-    }
+    if (SS.NeedsCopy)
+      return SS.Section->OutSec->Addr + SS.Section->OutSecOff;
     if (SS.NeedsPltAddr)
       return Body.getPltVA<ELFT>();
     return 0;
@@ -230,13 +228,6 @@ Undefined::Undefined(StringRefZ Name, bo
   this->File = File;
 }
 
-template <typename ELFT>
-InputSection<ELFT> *SharedSymbol<ELFT>::getBssSectionForCopy() const {
-  assert(NeedsCopy);
-  assert(CopySection);
-  return CopySection;
-}
-
 DefinedCommon::DefinedCommon(StringRef Name, uint64_t Size, uint64_t Alignment,
                              uint8_t StOther, uint8_t Type, InputFile *File)
     : Defined(SymbolBody::DefinedCommonKind, Name, /*IsLocal=*/false, StOther,

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=295288&r1=295287&r2=295288&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Feb 16 00:12:41 2017
@@ -274,10 +274,8 @@ public:
   // This field is a pointer to the symbol's version definition.
   const Elf_Verdef *Verdef;
 
-  // CopySection is significant only when NeedsCopy is true.
-  InputSection<ELFT> *CopySection = nullptr;
-
-  InputSection<ELFT> *getBssSectionForCopy() const;
+  // Section is significant only when NeedsCopy is true.
+  InputSection<ELFT> *Section = nullptr;
 };
 
 // This class represents a symbol defined in an archive file. It is

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=295288&r1=295287&r2=295288&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Feb 16 00:12:41 2017
@@ -1244,7 +1244,7 @@ SymbolTableSection<ELFT>::getOutputSecti
   case SymbolBody::SharedKind: {
     auto &SS = cast<SharedSymbol<ELFT>>(*Sym);
     if (SS.NeedsCopy)
-      return SS.getBssSectionForCopy()->OutSec;
+      return SS.Section->OutSec;
     break;
   }
   case SymbolBody::UndefinedKind:




More information about the llvm-commits mailing list