[lld] r366307 - [ELF] Delete redundant pageAlign at PT_GNU_RELRO boundaries after D58892

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 02:23:05 PDT 2019


Author: maskray
Date: Wed Jul 17 02:23:04 2019
New Revision: 366307

URL: http://llvm.org/viewvc/llvm-project?rev=366307&view=rev
Log:
[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

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=366307&r1=366306&r2=366307&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Jul 17 02:23:04 2019
@@ -2223,25 +2223,6 @@ template <class ELFT> void Writer<ELFT>:
     for (const PhdrEntry *p : part.phdrs)
       if (p->p_type == PT_LOAD && p->firstSec)
         pageAlign(p->firstSec);
-
-    for (const PhdrEntry *p : part.phdrs) {
-      if (p->p_type != PT_GNU_RELRO)
-        continue;
-
-      if (p->firstSec)
-        pageAlign(p->firstSec);
-
-      // Find the first section after PT_GNU_RELRO. If it is in a PT_LOAD we
-      // have to align it to a page.
-      auto end = outputSections.end();
-      auto i = llvm::find(outputSections, p->lastSec);
-      if (i == end || (i + 1) == end)
-        continue;
-
-      OutputSection *cmd = (*(i + 1));
-      if (needsPtLoad(cmd))
-        pageAlign(cmd);
-    }
   }
 }
 




More information about the llvm-commits mailing list