[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
Wed Sep 13 11:47:02 PDT 2023
================
@@ -1196,9 +1202,17 @@ void LinkerScript::adjustOutputSections() {
if (sec->sectionIndex != UINT32_MAX)
maybePropagatePhdrs(*sec, defPhdrs);
+ // Discard .relro_padding if we have not seen one non-NOBITS RELRO section.
+ // Note: when .tbss is the only RELRO section, it's difficult to pick a
+ // suitable padding size (see computeFilOffset). For simplicity, don't
+ // retain .relro_padding in this case.
+ if (in.relroPadding && in.relroPadding->getParent() == sec && !seenRelro)
+ discardable = true;
if (discardable) {
sec->markDead();
cmd = nullptr;
+ } else {
+ seenRelro |= sec->relro && sec->type != SHT_NOBITS;
----------------
smithp35 wrote:
Would it be worth restricting this to sec->type != SHT_NOBITS && (sec->flags & SHF_TLS)
https://github.com/llvm/llvm-project/pull/66042
More information about the llvm-commits
mailing list