[PATCH] D64854: [ELF] Delete redundant pageAlign of the first section after PT_GNU_RELRO after D58892
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 01:36:40 PDT 2019
MaskRay added a comment.
In D64854#1588981 <https://reviews.llvm.org/D64854#1588981>, @ruiu wrote:
> Could you explain what `ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1))` means? It looks like it aligns to the next multiple of MAXPAGESIZE (plus `(. & (CONSTANT (MAXPAGESIZE) - 1))`), so doesn't it consume a MAXPAGESIZE?
Say, the end address of the last segment is 0x4001d8. The PT_LOAD covers the address range [0x400000, 0x4001d8) (at runtime, the end address will rounded up). Currently we set the address of the new segment to the next multiple of max-page-size: 0x600000. Due to the rule: p_offset/p_vaddr must be equal modulo maxpagesize, we have to set its p_offset to 0x600000.
However, if we set the address of the new segment to 0x6001d8, its p_offset can be kept as 0x4001d8. This saves 0x600000-0x4001d8 bytes.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64854/new/
https://reviews.llvm.org/D64854
More information about the llvm-commits
mailing list