Output section description can contain ALIGN modificator:
https://sourceware.org/binutils/docs/ld/Output-Section-Description.html#Output-Section-Description
Patch implements it.
Differential D22674
[ELF] - Linkerscript: implemented ALIGN modificatior of output sections. Authored by grimar on Jul 22 2016, 5:51 AM.
Details
Output section description can contain ALIGN modificator: Patch implements it.
Diff Detail Event TimelineComment Actions ALIGN shouldn't be implemented as a special feature that is allowed only after ":" in SECTIONS subcommands. It is a generic function as described in https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#Builtin-Functions. If you support an expression after ":" in the context and the ALIGN built-in function, this feature is going to naturally be supported. Comment Actions I think we have different typese of ALIGN here. One is a output section description modificator. The other ALIGN is a generic function, as you mentioned. I think location counter value in output secrion description is "global", but Because of above I think patch implements it in a correct way. Comment Actions So, the full description of an output section looks like this: section [address] [(type)] :
[AT(lma)]
[ALIGN(section_align) | ALIGN_WITH_INPUT]
[SUBALIGN(subsection_align)]
[constraint]
{
output-section-command
output-section-command
...
} [>region] [AT>lma_region] [:phdr :phdr ...] [=fillexp] [,]There are just a few things that can be between ":" and "{". One of them is ALIGN. Comment Actions Instead of adding new code to the function, can you create a new function that processes only ALIGN option?
Comment Actions I moved the handling to a assignAddresses() method, IMO more appropriate for that, and so handling is just 2 lines now.
Comment Actions @Octav It doesn't. You can verify that the token "ALIGN_WITH_INPUT" is not mentioned in lld/ELF. What would be helpful is to give your minimized linker script which uses ALIGN_WITH_INPUT. | ||||||||||||||||||||
if (skip("ALIGN")) readAlign(Cmd);