[PATCH] D38361: [ELF] Stop setting output section size early
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 10:14:12 PDT 2017
peter.smith added a comment.
Apologies for the drive by comment, I need to leave the office fairly soon. In this specific case might it be simpler to only early calculate the size of non SHF_ALLOC content such as debug sections as the OutputSection doesn't get an address, just an offset and doesn't affect the addresses of any other SHF_ALLOC content, it is therefore safe to calculate the OutputSection size early.
In the general case I think the late addition and removal of content such as Thunks, Mips GOT entries, errata fixes and I'm guessing at RiscV relaxation are going to require some kind of iteration to a fixed point. I usually find iterating to a fixed point better than trying to predict addresses/sizes as it is easy to miss hard to predict corner cases. I'm wondering if it is possible to make this kind of iteration clearer by having a kind of Relaxation() stage that we can add functions that may need to update addresses and sizes to, this should hopefully make such code easier to understand. Probably a separate series of refactorings though.
I recommend splitting out the SHF_LINK_ORDER change into a separate patch if it is unrelated.
https://reviews.llvm.org/D38361
More information about the llvm-commits
mailing list