<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 5, 2017 at 1:17 PM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Peter Collingbourne via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> writes:<br>
<br>
> Relatedly, I discovered a bug in this patch. We can't use SHT_NOBITS for the new section because we need to lay out all NOBITS sections contiguously at the end of the LOAD. RELRO also needs to be contiguous (there can only be one RELRO header), so we can't have another RELRO covering part of the bss.<br>
<br>
</span>You could move the RELRO to the end of the regular RW PT_LOAD, no? That way it<br>
will be just before the nobits sections and the nobits sections could<br>
start with RELRO ones. That way the RELRO segment would span the end of<br>
the regular (non-nobits) sections and the start of the nobits ones.<br></blockquote><div><br></div><div>Yes, I think that would work, thanks. So the layout would be:</div><div><br></div><div>non-RELRO non-NOBITS</div><div>[page alignment]</div><div>RELRO non-NOBITS</div><div>RELRO NOBITS</div><div>[page alignment]</div><div>non-RELRO NOBITS</div><div><br></div><div>The downside is that there would be an extra page alignment, but that doesn't seem too important.</div><div><br></div><div>Thanks,</div></div>-- <br><div class="m_2632005012742610644gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>