[PATCH] D44943: Fill the last page of each executable section with 0xcc or equivalent.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 01:50:57 PDT 2018


grimar accepted this revision.
grimar added a comment.
This revision is now accepted and ready to land.

LGTM + nit/suggestion.



================
Comment at: lld/ELF/Writer.cpp:2209
+      continue;
+    if ((Sec->Offset + Sec->Size) % Target->PageSize == 0)
+      continue;
----------------
So, should this check be removed for simplicity of code?
(basing on comments, it makes no sense to have it, right?)

Then, btw, code could be:

```
  for (OutputSection *Sec : OutputSections)
    if (Sec->PtLoad && Sec->PtLoad == PT_LOAD && (Sec->PtLoad->p_flags & PF_X))
      fillTrap(Buf + alignDown(Sec->Offset + Sec->Size, Target->PageSize));
```


https://reviews.llvm.org/D44943





More information about the llvm-commits mailing list