[PATCH] D30463: [ELF] - Reset output section size when assigning offsets.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 03:22:51 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL296609: [ELF] - Reset output section size when assigning offsets. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D30463?vs=90041&id=90151#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30463

Files:
  lld/trunk/ELF/OutputSections.cpp
  lld/trunk/ELF/Relocations.cpp
  lld/trunk/ELF/Writer.cpp


Index: lld/trunk/ELF/OutputSections.cpp
===================================================================
--- lld/trunk/ELF/OutputSections.cpp
+++ lld/trunk/ELF/OutputSections.cpp
@@ -87,7 +87,6 @@
 template <class ELFT> void OutputSection::finalize() {
   if ((this->Flags & SHF_LINK_ORDER) && !this->Sections.empty()) {
     std::sort(Sections.begin(), Sections.end(), compareByFilePosition<ELFT>);
-    Size = 0;
     assignOffsets<ELFT>();
 
     // We must preserve the link order dependency of sections with the
@@ -133,7 +132,7 @@
 // This function is called after we sort input sections
 // and scan relocations to setup sections' offsets.
 template <class ELFT> void OutputSection::assignOffsets() {
-  uint64_t Off = this->Size;
+  uint64_t Off = 0;
   for (InputSection *S : Sections) {
     Off = alignTo(Off, S->Alignment);
     S->OutSecOff = Off;
Index: lld/trunk/ELF/Relocations.cpp
===================================================================
--- lld/trunk/ELF/Relocations.cpp
+++ lld/trunk/ELF/Relocations.cpp
@@ -886,7 +886,6 @@
   std::merge(OS->Sections.begin(), OS->Sections.end(), Thunks.begin(),
              Thunks.end(), std::back_inserter(Tmp), MergeCmp);
   OS->Sections = std::move(Tmp);
-  OS->Size = 0;
   OS->assignOffsets<ELFT>();
 }
 
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1025,7 +1025,6 @@
   for (SyntheticSection *SS : Sections)
     if (SS && SS->OutSec && !SS->empty()) {
       SS->finalizeContents();
-      SS->OutSec->Size = 0;
       SS->OutSec->template assignOffsets<ELFT>();
     }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30463.90151.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170301/3d134517/attachment.bin>


More information about the llvm-commits mailing list