[PATCH] D64854: [ELF] Delete redundant pageAlign of the first section after PT_GNU_RELRO after D58892

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 00:55:56 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, peter.smith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

D58892 <https://reviews.llvm.org/D58892> splits the RW PT_LOAD on the PT_GNU_RELRO boundary. The new
PT_LOAD triggers:

  if (p->p_type == PT_LOAD && p->firstSec)
    pageAlign(p->firstSec);

which makes the pageAlign below redundant.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D64854

Files:
  ELF/Writer.cpp


Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -2230,17 +2230,6 @@
 
       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);
     }
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64854.210262.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190717/1557126d/attachment.bin>


More information about the llvm-commits mailing list