This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Give error message when relro sections are not contiguous.
ClosedPublic

Authored by peter.smith on Nov 22 2017, 7:43 AM.

Details

Summary

This is patch 1 of 3 spun out from D40029 covering : Give an error if relro is not contiguous.

If a linker script is used that names linker generated synthetic sections it is possible that the OutputSections for which isRelroSection() is true are not contiguous. When the relro sections are not contiguous we cannot describe them with a single PT_GNU_RELRO PHDR. Unfortunately at least one contemporary dynamic loader only supports one PT_GNU_RELRO PHDR so we cannot output more than one of these PHDRs. As not including relro sections in the PHDR will lead to security sensitive sections being
writeable we choose to give an error message instead.

Patches 2 and 3 will cover:

  • Relax handling of empty sections.
  • Name change when linker scripts are used.

Diff Detail

Repository
rL LLVM