[ELF] Align SHT_LLVM_PART_EHDR to a maximum page size boundary
authorFangrui Song <maskray@google.com>
Mon, 2 Sep 2019 08:49:50 +0000 (08:49 +0000)
committerFangrui Song <maskray@google.com>
Mon, 2 Sep 2019 08:49:50 +0000 (08:49 +0000)
commit4514ac7cfb1091c44eb8a60220adb712c7e5622e
treea30c29d97630c2e05a176b530090ab78c6b99303
parent6897a814e66f2a2d7e0bec07d7a553b5020123de
[ELF] Align SHT_LLVM_PART_EHDR to a maximum page size boundary

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=998712

SHT_LLVM_PART_EHDR marks the start of a partition. The partition
sections will be extracted to a separate file. Align to the next maximum
page size boundary so that we can find the ELF header at the start. We
cannot benefit from overlapping p_offset ranges with the previous
segment anyway.

It seems we lack some llvm-objcopy --extract-main-partition and
--extract-partition sanity checks. It may place EHDR at the start
even if p_offset if non zero. Anyway, the lld change is justified for
the reasons above.

Reviewed By: ruiu

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

llvm-svn: 370629
lld/ELF/Writer.cpp
lld/test/ELF/partitions.s