[ELF] Skip over empty sections when checking for contiguous relro
authorPeter Smith <peter.smith@linaro.org>
Thu, 23 Nov 2017 15:10:00 +0000 (15:10 +0000)
committerPeter Smith <peter.smith@linaro.org>
Thu, 23 Nov 2017 15:10:00 +0000 (15:10 +0000)
commitc076b280df622792cfb11c59c3319e40d5cec8b2
tree289cf58e6d1943544c8653d34541b088f68e39d9
parent9e5477f4734ba85256a6508a54a200fa2aaf6ddf
[ELF] Skip over empty sections when checking for contiguous relro

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.

Differential Revision: https://reviews.llvm.org/D40364

llvm-svn: 318924
lld/ELF/Writer.cpp
lld/test/ELF/relro-non-contiguous-zerosize.s [new file with mode: 0644]