[PATCH] D74297: [ELF] Start a new PT_LOAD if LMA region is different
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 13:46:09 PST 2020
MaskRay updated this revision to Diff 243988.
MaskRay added a comment.
Adopt peter.smith's Suggestion 1
In D74297#1869573 <https://reviews.llvm.org/D74297#1869573>, @psmith wrote:
> Thanks for the update, looks good to me.
> Some suggestions for the expression, not sure if they are better or not, so by all means keep the original if you prefer.
>
> Suggestion 1, rename propagateLMA to sameLMARegion, my brain tended to lump the program header case and the same memory region under propagateLMA
>
> bool sameLMARegion =
> load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion;
> if (!(load && newFlags == flags && sec != relroEnd &&
> sec->memRegion == load->firstSec->memRegion &&
> (sameLMARegion || load->lastSec == Out::programHeaders)))
>
>
> Suggestion 2, add `|| load->lastSec == Out::programHeaders` into propagateLMA
>
> bool propagateLMA =
> (load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion) || load->lastSec == Out::programHeaders;
> if (!(load && newFlags == flags && sec != relroEnd &&
> sec->memRegion == load->firstSec->memRegion &&
> propagateLMA))
>
Thanks for the suggestions.
Adopted Suggestion 1.
For Suggestion 2: `load->lastSec == Out::programHeaders` is a special case from D43284 <https://reviews.llvm.org/D43284>. It is not the same LMA region, so I will not place the condition into `sameLMARegion`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74297/new/
https://reviews.llvm.org/D74297
Files:
lld/ELF/LinkerScript.cpp
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/Inputs/at2.s
lld/test/ELF/linkerscript/at2.test
lld/test/ELF/linkerscript/at8.test
lld/test/ELF/linkerscript/lma-align.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74297.243988.patch
Type: text/x-patch
Size: 5715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200211/62963f6b/attachment.bin>
More information about the llvm-commits
mailing list