[lld] [ELF] Align the end of PT_GNU_RELRO associated PT_LOAD to a common-page-size boundary (PR #66042)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 08:21:36 PDT 2023


https://github.com/smithp35 commented:

I've not had a chance to go through the code changes in detail yet. 

Can you help me out a bit with what is causing the problem? Is it just that strip is corrupting the output, or is that just one of the problems?

The description says "system-page-size < common-page-size". 

What does system-page-size refer to? Do you mean max-page-size? Or is it something like the page size used by the OS? For example: AArch64 max-page-size = 64Kib common-page-size = 4 KiB. An OS may set system-page-size to 4KiB but if I link with max-page-size and common-page-size set to 64 KiB then system-page-size < common-page (and max-page-size).

I mention that because we currently don't permit common-page-size to be larger than max-page-size.
```
getCommonPageSize()
...
  // commonPageSize can't be larger than maxPageSize.                                                                                                               if (val > config->maxPageSize)
    val = config->maxPageSize;
```

In the description
> in the absence of PHDRS/SECTIONS: ensure the end of PT_GNU_RELRO associated PT_LOAD to a common-page-size boundary

Looks like the sentence is missing a few words on alignment. Perhaps: 
> ensure the end of the PT_LOAD program loader associated with the PT_GNU_RELRO segment is aligned to a common-page-size boundary.

https://github.com/llvm/llvm-project/pull/66042


More information about the llvm-commits mailing list