[PATCH] D40364: [ELF] Skip over empty sections when checking for contiguous relro

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:02:00 PST 2017


peter.smith created this revision.
Herald added subscribers: arichardson, emaste.

This is patch 2 of 3 spun out from https://reviews.llvm.org/D40029 covering : Relax handling of empty sections..

When checking for contiguous relro sections we can skip over empty sections. If there is an empty non-relro section in the middle of a contiguous block of relro sections then it cannot be written to so it is safe to include in PT_GNU_RELRO header. If there is a contiguous block of empty relro sections then no PT_GNU_RELRO header is required for them.

The check for an OutputSection being empty is a little more complex than I'd like. As the size of some synthetic sections isn't known at the point we need to check for zero size we have to use SyntheticSection::empty() to check.

Patch 3 will cover:

- Name change when linker scripts are used.


https://reviews.llvm.org/D40364

Files:
  ELF/Writer.cpp
  test/ELF/relro-non-contiguous-zerosize.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40364.123968.patch
Type: text/x-patch
Size: 3545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171122/e48d59d0/attachment.bin>


More information about the llvm-commits mailing list