<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 5, 2017 at 1:49 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 <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> writes:<br>
<br>
> On Thu, Jan 5, 2017 at 1:17 PM, Rafael Avila de Espindola <<br>
> <a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>> wrote:<br>
><br>
>> 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<br>
>> the new section because we need to lay out all NOBITS sections contiguously<br>
>> at the end of the LOAD. RELRO also needs to be contiguous (there can only<br>
>> be one RELRO header), so we can't have another RELRO covering part of the<br>
>> bss.<br>
>><br>
>> You could move the RELRO to the end of the regular RW PT_LOAD, no? That<br>
>> 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>
>><br>
><br>
> Yes, I think that would work, thanks. So the layout would be:<br>
><br>
> non-RELRO non-NOBITS<br>
> [page alignment]<br>
> RELRO non-NOBITS<br>
> RELRO NOBITS<br>
> [page alignment]<br>
> non-RELRO NOBITS<br>
><br>
> The downside is that there would be an extra page alignment, but that<br>
> doesn't seem too important.<br>
<br>
</span>We already have two alignments. What we currently have is:<br>
<br>
   [page alignment]<br>
   RELRO (always non-NOBITS)<br>
   [page alignment]<br>
   non-RELRO non-NOBITS<br>
   non-RELRO NOBITS<br></blockquote><div><br></div><div>Yes, but we'd still need a page alignment at the start of the r/w segment, no?</div><div><br></div><div>Thanks,</div><div>-- <br></div></div><div class="m_-2238509346797394030gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Peter</div></div></div>
</div></div>