[ELF] Initialize PhdrEntry::p_align to maxPageSize for PT_LOAD
authorFangrui Song <maskray@google.com>
Thu, 5 Sep 2019 16:32:31 +0000 (16:32 +0000)
committerFangrui Song <maskray@google.com>
Thu, 5 Sep 2019 16:32:31 +0000 (16:32 +0000)
commit6dc2bd70bb7e68aa897d2b5e00b5863916f53bba
tree4312503bb7466bf5697629454d7c021e1bc5b92b
parentae900d388237b11dd92da42097f77cc77a398e90
[ELF] Initialize PhdrEntry::p_align to maxPageSize for PT_LOAD

```
Writer<ELFT>::run
  assignFileOffsets
    setFileOffset
      computeFileOffset
        os->ptLoad->p_align may be smaller than config->maxPageSize
  setPhdrs
    p_align = max(p_align, config->maxPageSize)
```

If we move the config->maxPageSize logic to the constructor of
PhdrEntry, computeFileOffset can be simplified.

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D67211

llvm-svn: 371085
lld/ELF/Writer.cpp
lld/ELF/Writer.h