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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 02:41:07 PDT 2016


grimar added a comment.

In http://reviews.llvm.org/D19981#423197, @ruiu wrote:

> 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.


While this is not large vector of pointers, it should be fine.


================
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);
+
----------------
ruiu wrote:
> Move this after the code to add BuildId to remove the variable I.
> 
>   if (needsInterpSection())
>     OutputSections.insert(OutputSections.begin(), Out<ELFT>::Interp);
Done.

================
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.
----------------
ruiu wrote:
> now -> to beginning of the file
Done.


http://reviews.llvm.org/D19981





More information about the llvm-commits mailing list