Add support of SECTIONS command:
- determine output section by input section name
- discard input sections
- order output sections accordingly
- don't add bounding symbols (__start/__stop) for sections defined in the linker script
Differential D14140
[ELF2] SECTIONS command basic support denis-protivensky on Oct 28 2015, 1:31 AM. Authored by
Details Add support of SECTIONS command:
Diff Detail Event Timeline
Comment Actions Updated:
Comment Actions 2015/10/29 8:31 "Denis Protivensky" <dprotivensky@accesssoftek.com>:
too long. Move this lambda out of this function.
in the lambda, and I think it would be ugly to pass it to the comparison
!RegularSections.(A)||!RegularSections.count(B) condition for?
others with default sorting order even if some of these names are defined I don't think we need that protection. If users try to reorder such Comment Actions
First of all, I reproduced the case when defining 'specific' section in the SECTIONS command affects its ordering in the resulting file without the check, so this check works as I expected. Concerning ordering of 'specific' sections: .interp : { *(.interp) } is void because there are no input .interp sections, and such empty output sections are discarded by linker rules. The only way this format of command worked is to define custom .interp section (possibly of SHT_PROGBITS/_NOBITS type). Then it will be considered during layout, but that's a specific case and it's checked in tests (with .shstrtab custom section). Just as a note: ld doesn't seem as well to reorder 'specific' sections even if defined in linker script.
Comment Actions I think this falls in the category of undefined behaviors if there was a
Comment Actions Updated:
Comment Actions Updated:
Comment Actions
It is not clear if this is needed by real program. For now just leave
no? Comment Actions I'll leave simpler code, thanks.
Comment Actions Updated:
Comment Actions One question is the performance with this patch. Does this slow down the linker? If so, how much?
Comment Actions The average of 20 iterations of self-linking lld on my machine:
Comment Actions LGTM with a nit.
|
A struct with one field doesn't have much value. Please remove.