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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 18:51:59 PDT 2016


ruiu added a comment.

Naturally this change made me wonder whether this is too inefficient or not, but it is probably okay since the number of output sections is not very large.


================
Comment at: ELF/Writer.cpp:1470-1474
@@ -1480,1 +1469,7 @@
 
+  // Add .interp at first because some loaders want to see that section
+  // on the first page of the executable file when loaded into memory.
+  auto I = OutputSections.begin();
+  if (needsInterpSection())
+    I = OutputSections.insert(I, Out<ELFT>::Interp);
+
----------------
Move this after the code to add BuildId to remove the variable I.

  if (needsInterpSection())
    OutputSections.insert(OutputSections.begin(), Out<ELFT>::Interp);

================
Comment at: ELF/Writer.cpp:1477
@@ +1476,3 @@
+  // 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.
----------------
now -> to beginning of the file


http://reviews.llvm.org/D19981





More information about the llvm-commits mailing list