This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Skip over empty sections when checking for contiguous relro
ClosedPublic

Authored by peter.smith on Nov 22 2017, 10:00 AM.

Details

Summary

This is patch 2 of 3 spun out from 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.

Diff Detail

Repository
rL LLVM