Skip to content

Commit 2be0ebb

Browse files
committed
[ELF] Delete redundant pageAlign at PT_GNU_RELRO boundaries after D58892
Summary: After D58892 split the RW PT_LOAD on the PT_GNU_RELRO boundary, the new layout is: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss) The two pageAlign() calls at PT_GNU_RELRO boundaries are redundant due to the existence of PT_LOAD. Reviewers: grimar, peter.smith, ruiu, espindola Reviewed By: ruiu Subscribers: sfertile, atanasyan, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64854 llvm-svn: 366307
1 parent 9eb9590 commit 2be0ebb

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

lld/ELF/Writer.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,25 +2223,6 @@ template <class ELFT> void Writer<ELFT>::fixSectionAlignments() {
22232223
for (const PhdrEntry *p : part.phdrs)
22242224
if (p->p_type == PT_LOAD && p->firstSec)
22252225
pageAlign(p->firstSec);
2226-
2227-
for (const PhdrEntry *p : part.phdrs) {
2228-
if (p->p_type != PT_GNU_RELRO)
2229-
continue;
2230-
2231-
if (p->firstSec)
2232-
pageAlign(p->firstSec);
2233-
2234-
// Find the first section after PT_GNU_RELRO. If it is in a PT_LOAD we
2235-
// have to align it to a page.
2236-
auto end = outputSections.end();
2237-
auto i = llvm::find(outputSections, p->lastSec);
2238-
if (i == end || (i + 1) == end)
2239-
continue;
2240-
2241-
OutputSection *cmd = (*(i + 1));
2242-
if (needsPtLoad(cmd))
2243-
pageAlign(cmd);
2244-
}
22452226
}
22462227
}
22472228

0 commit comments

Comments
 (0)