[lld] [ELF] Align the end of PT_GNU_RELRO associated PT_LOAD to a common-page-size boundary (PR #66042)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 14:54:45 PDT 2023
================
@@ -920,7 +929,9 @@ static unsigned getSectionRank(const OutputSection &osec) {
// TLS sections directly before the other RELRO sections.
if (!(osec.flags & SHF_TLS))
rank |= RF_NOT_TLS;
- if (!isRelroSection(&osec))
+ if (isRelroSection(&osec))
+ osec.relro = true;
----------------
MaskRay wrote:
`ScriptParser::readSections` clears `relro` if there is no `DATA_SEGMENT_RELRO_END`.
After `getSectionRank`, `relro` has changed its meaning: whether the section is RELRO, to be checked in `seenRelro |= sec->relro && sec->type != SHT_NOBITS;`.
In the absence of `DATA_SEGMENT_RELRO_END`, this code is still correct.
https://github.com/llvm/llvm-project/pull/66042
More information about the llvm-commits
mailing list