This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Expand LMA region if output section alignment introduces padding
ClosedPublic

Authored by kschwarz on Nov 18 2021, 8:06 AM.

Details

Summary

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.

Diff Detail

Event Timeline

kschwarz created this revision.Nov 18 2021, 8:06 AM
kschwarz requested review of this revision.Nov 18 2021, 8:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2021, 8:06 AM
MaskRay accepted this revision.Nov 18 2021, 7:05 PM

LGTM.

lld/test/ELF/linkerscript/lma-align2.test
24
25
30
33
This revision is now accepted and ready to land.Nov 18 2021, 7:05 PM
ikudrin added inline comments.Nov 19 2021, 1:05 AM
lld/ELF/LinkerScript.cpp
981–988

ctx->lmaRegion is the same as mr/sec->lmaRegion due to the assignment on line 944. Referencing it by different names is a bit bewildering.

kschwarz updated this revision to Diff 388435.Nov 19 2021, 2:11 AM
kschwarz marked 5 inline comments as done.
kschwarz edited the summary of this revision. (Show Details)

Address comments