Follow-up for D74286.
Notations:
- alignExpr: the computed ALIGN value
- max_input_align: the maximum of input section alignments
This patch changes the following two cases to match GNU ld:
- When ALIGN is present, GNU ld sets output sh_addr to alignExpr, while lld use max(alignExpr, max_input_align)
- When addrExpr is specified but alignExpr is not, GNU ld sets output sh_addr to addrExpr, while lld uses advance(0, max_input_align)
Note, sh_addralign is still set to max(alignExpr, max_input_align).
lma-align.test is enhanced a bit to check we don't overalign sh_addr.
fixSectionAlignments() sets addrExpr but not alignExpr for the !hasSectionsCommand case.
This patch sets alignExpr as well so that max_input_align will be respected.
Would it be worth a comment:
// When not using a linker script sec->alignExpr is set to the maximum of input section alignments.