[PATCH] D22683: [ELF] Symbol assignment within input section list

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 16:56:28 PDT 2016


ruiu added a comment.

I'm still thinking about the best way to support it, and I feel like there's a way, but I think it's better to land this. We can improve it later if needed.

There's a question for you. How are you going to support assignments to "." inside output section descriptors?


================
Comment at: ELF/OutputSections.cpp:845-847
@@ -844,2 +844,5 @@
   this->updateAlignment(S->Alignment);
+  uintX_t Off = alignTo(this->Header.sh_size, S->Alignment);
+  S->OutSecOff = Off;
+  this->Header.sh_size = Off + S->getSize();
 }
----------------
Okay, so you seems to call assignOffsets() in sortInitFini because we need to assign offsets after sorting input sections. But if you sort input sections, the total output section size may change, because padding sizes to satisfy alignment requirements may change.

I think you wan tto compute the total size of sections inside assignOffsets. I mean, you can make this function really just add input section to the vector and does nothing more than that, and let assignOffsets compute the alignment and the output section size.

================
Comment at: ELF/OutputSections.cpp:894
@@ -890,1 +893,3 @@
+
+  assignOffsets();
 }
----------------
If there's no .init or .ctors, assignOffsets is not called? Is it correct?


https://reviews.llvm.org/D22683





More information about the llvm-commits mailing list