[lld] r251193 - ELF2: Remove setNameOffset and combine that with writeHeader. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 24 10:57:39 PDT 2015


Author: ruiu
Date: Sat Oct 24 12:57:39 2015
New Revision: 251193

URL: http://llvm.org/viewvc/llvm-project?rev=251193&view=rev
Log:
ELF2: Remove setNameOffset and combine that with writeHeader. NFC.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.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=251193&r1=251192&r2=251193&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Sat Oct 24 12:57:39 2015
@@ -224,6 +224,7 @@ InterpSection<ELFT>::InterpSection()
 
 template <class ELFT>
 void OutputSectionBase<ELFT>::writeHeaderTo(Elf_Shdr *SHdr) {
+  Header.sh_name = Out<ELFT>::ShStrTab->getOffset(Name);
   *SHdr = Header;
 }
 

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=251193&r1=251192&r2=251193&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Sat Oct 24 12:57:39 2015
@@ -80,7 +80,6 @@ public:
   void setFileOffset(uintX_t Off) { Header.sh_offset = Off; }
   void writeHeaderTo(Elf_Shdr *SHdr);
   StringRef getName() { return Name; }
-  void setNameOffset(uintX_t Offset) { Header.sh_name = Offset; }
 
   unsigned SectionIndex;
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251193&r1=251192&r2=251193&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Oct 24 12:57:39 2015
@@ -740,10 +740,8 @@ template <class ELFT> void Writer<ELFT>:
   auto SHdrs = reinterpret_cast<Elf_Shdr *>(Buf + EHdr->e_shoff);
   // First entry is null.
   ++SHdrs;
-  for (OutputSectionBase<ELFT> *Sec : OutputSections) {
-    Sec->setNameOffset(Out<ELFT>::ShStrTab->getOffset(Sec->getName()));
+  for (OutputSectionBase<ELFT> *Sec : OutputSections)
     Sec->writeHeaderTo(SHdrs++);
-  }
 }
 
 template <class ELFT> void Writer<ELFT>::openFile(StringRef Path) {




More information about the llvm-commits mailing list