[PATCH] D23165: [ELF] - Linkerscript: implement SIZEOF_HEADERS.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 10:49:09 PDT 2016


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: ELF/LinkerScript.cpp:241
@@ -240,3 +240,3 @@
   // Assign addresses as instructed by linker script SECTIONS sub-commands.
-  Dot = Out<ELFT>::ElfHeader->getSize() + Out<ELFT>::ProgramHeaders->getSize();
+  Dot = getSizeOfHeaders();
   uintX_t MinVA = std::numeric_limits<uintX_t>::max();
----------------
grimar wrote:
> I hope there will not be scripts with first linke like:
> 
> ```
> . += SIZEOF_HEADERS;
> ```
Let's see how it works! If it works, it's definitely better.

================
Comment at: ELF/LinkerScript.cpp:923
@@ -917,1 +922,3 @@
 
+static uint64_t getSizeOfHeaders() {
+  switch (Config->EKind) {
----------------
This technique is getting ugly as we have more and more functions to interact with the template class. At some point we probably should use a different technique. But for now it is fine (and probably still preferable.)


https://reviews.llvm.org/D23165





More information about the llvm-commits mailing list