[ELF] Expand LMA region if output section alignment introduces padding
authorKonstantin Schwarz <konstantin.schwarz@hightec-rt.com>
Thu, 18 Nov 2021 14:21:21 +0000 (15:21 +0100)
committerKonstantin Schwarz <konstantin.schwarz@hightec-rt.com>
Fri, 19 Nov 2021 10:27:21 +0000 (11:27 +0100)
commit8c18719bae6f0fe6ff97adad2303c447083e14be
tree946f33fa0ab19b6a00b0a5701058ae217eb0b7bd
parent6259016361345e09f0607ef4e037e00bcbe4bd40
[ELF] Expand LMA region if output section alignment introduces padding

When aligning the start address of an output section introduces a gap between the current dot pointer
and the new aligned address, we were already properly expanding the memory region, if available.

D74286 introduced a new behavior to also align the LMA address if an LMA region is specified.
However, this did not expand the corresponding LMA region.
Now, we also expand the LMA region if it is set.

This fixes PR52510.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D114166
lld/ELF/LinkerScript.cpp
lld/test/ELF/linkerscript/lma-align2.test [new file with mode: 0644]