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

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 13:59:49 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/LinkerScript.cpp:120-121
@@ -122,1 +119,4 @@
+    // .foo : { *(.foo.*) end_foo = .; }
+    SectionOffset = alignTo(SectionOffset, C->Alignment);
+    SectionOffset += C->getSize();
   };
----------------
ruiu wrote:
> evgeny777 wrote:
> > ruiu wrote:
> > > This offset computation is not accurate. On MIPS or ARM, input sections may have additional pieces of data, or thunks, at their ends. Thunks are added to input sections in Writetr::finalizeSections, so in this function we don't know the exact size of input sections. So this is computing offsets too early.
> > Thanks for pointing this out. I suggest calculating offsets in addScriptedSymbols than. What's your opinion?
> If you can do it, it would work, but I"m not sure how you are going to do it.
I think this can be done by implementing a special sort of input section (like SymbolInputSection<ELFT>) with zero size and alignment of 1. One can store a list of such sections in LinkerScript<ELFT> and calculate real offset, taking SymbolInputSection<ELFT>::OutSec as a starting point.

I believe there should be other ways also. Need some research.


https://reviews.llvm.org/D22683





More information about the llvm-commits mailing list