[PATCH] D19981: [ELF] - add predefined sections to output sections list in one place.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 07:33:51 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL275269: [ELF] - Add predefined sections to output sections list in one place. (authored by grimar).

Changed prior to commit:
  http://reviews.llvm.org/D19981?vs=63671&id=63805#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19981

Files:
  lld/trunk/ELF/Writer.cpp

Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -604,17 +604,6 @@
 
 // Create output section objects and add them to OutputSections.
 template <class ELFT> void Writer<ELFT>::createSections() {
-  // Add .interp first because some loaders want to see that section
-  // on the first page of the executable file when loaded into memory.
-  if (needsInterpSection())
-    OutputSections.push_back(Out<ELFT>::Interp);
-
-  // A core file does not usually contain unmodified segments except
-  // the first page of the executable. Add the build ID section now
-  // so that the section is included in the first page.
-  if (Out<ELFT>::BuildId)
-    OutputSections.push_back(Out<ELFT>::BuildId);
-
   // Create output sections for input object file sections.
   std::vector<OutputSectionBase<ELFT> *> RegularSections;
   OutputSectionFactory<ELFT> Factory;
@@ -793,6 +782,17 @@
       OutputSections.push_back(C);
   };
 
+  // A core file does not usually contain unmodified segments except
+  // the first page of the executable. Add the build ID section to beginning of
+  // the file so that the section is included in the first page.
+  if (Out<ELFT>::BuildId)
+    OutputSections.insert(OutputSections.begin(), Out<ELFT>::BuildId);
+
+  // Add .interp at first because some loaders want to see that section
+  // on the first page of the executable file when loaded into memory.
+  if (needsInterpSection())
+    OutputSections.insert(OutputSections.begin(), Out<ELFT>::Interp);
+
   // This order is not the same as the final output order
   // because we sort the sections using their attributes below.
   Add(Out<ELFT>::SymTab);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19981.63805.patch
Type: text/x-patch
Size: 1747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160713/663a3865/attachment.bin>


More information about the llvm-commits mailing list