[PATCH] D74297: [ELF] Start a new PT_LOAD if LMA region is different
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 03:32:42 PST 2020
psmith added a comment.
Change looks good to me. Some small nits.
================
Comment at: lld/ELF/Writer.cpp:2120
sec == relroEnd) {
load = addHdr(PT_LOAD, newFlags);
flags = newFlags;
----------------
I 'm struggling to read that boolean expression. Would it be possible to move some of the bits around so that the && is at the end or maybe calculate the more complex ones and name them?
A reorder (untested)
```
if (!load ||
sec->memRegion != load->firstSec->memRegion ||
flags != newFlags ||
sec == relroEnd ||
(load->lastSec != Out::programHeaders &&
(sec->lmaExpr ||
!sec->lmaRegion != !lmaRegion ||
(sec->lmaRegion && sec->lmaRegion != lmaRegion))
)
);
```
Is there any way to rewrite this in the positive form, we have quite a lot of negatives.
`!sec->lmaRegion != !lmaRegion`
For example `set->lmaRegion == nullptr != lmaRegion == nullptr` writing it in that form made it easier to read.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74297/new/
https://reviews.llvm.org/D74297
More information about the llvm-commits
mailing list