[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size
authorFangrui Song <i@maskray.me>
Thu, 12 May 2022 18:03:12 +0000 (11:03 -0700)
committerFangrui Song <i@maskray.me>
Thu, 12 May 2022 18:03:12 +0000 (11:03 -0700)
commitebdb9d635a077274e38baa8584f5b0e631b4b1d3
tree48ae88185cc7454eba9de4afd5e10bf6f6065bf0
parent9f732af583c0dba58847b753a87cc5432ec33f09
[ELF] Align the end of PT_GNU_RELRO to max-page-size instead of common-page-size

We picked common-page-size to match GNU ld. Recently, the resolution to GNU ld
https://sourceware.org/bugzilla/show_bug.cgi?id=28824 (milestone: 2.39) switched
to max-page-size so that the last page can be protected by RELRO in case the
system page size is larger than common-page-size.

Thanks to our two RW PT_LOAD scheme (D58892), switching to max-page-size does
not change file size (while GNU ld's scheme may increase file size).

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D125410
lld/ELF/Writer.cpp
lld/docs/ReleaseNotes.rst
lld/test/ELF/aarch64-relro.s
lld/test/ELF/basic-ppc64.s