<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 28, 2017 at 4: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">>    // Dynamic section must be the last one in this list and dynamic<br>
>    // symbol table section (DynSymTab) must be the first one.<br>
>    finalizeSynthetic<ELFT>(<br>
> -      {In<ELFT>::DynSymTab, In<ELFT>::GnuHashTab, In<ELFT>::HashTab,<br>
> -       In<ELFT>::SymTab,    In<ELFT>::ShStrTab,   In<ELFT>::StrTab,<br>
> -       In<ELFT>::VerDef,    In<ELFT>::DynStrTab,  In<ELFT>::GdbIndex,<br>
> -       In<ELFT>::Got,       In<ELFT>::MipsGot,    In<ELFT>::IgotPlt,<br>
> -       In<ELFT>::GotPlt,    In<ELFT>::RelaDyn,    In<ELFT>::RelaIplt,<br>
> -       In<ELFT>::RelaPlt,   In<ELFT>::Plt,        In<ELFT>::Iplt,<br>
> -       In<ELFT>::Plt,       In<ELFT>::EhFrameHdr, In<ELFT>::VerSym,<br>
> -       In<ELFT>::VerNeed,   In<ELFT>::Dynamic});<br>
> +      {In<ELFT>::Bss,        In<ELFT>::BssRelRo, In<ELFT>::DynSymTab,<br>
> +       In<ELFT>::GnuHashTab, In<ELFT>::HashTab,  In<ELFT>::SymTab,<br>
> +       In<ELFT>::ShStrTab,   In<ELFT>::StrTab,   In<ELFT>::VerDef,<br>
> +       In<ELFT>::DynStrTab,  In<ELFT>::GdbIndex, In<ELFT>::Got,<br>
> +       In<ELFT>::MipsGot,    In<ELFT>::IgotPlt,  In<ELFT>::GotPlt,<br>
> +       In<ELFT>::RelaDyn,    In<ELFT>::RelaIplt, In<ELFT>::RelaPlt,<br>
> +       In<ELFT>::Plt,        In<ELFT>::Iplt,     In<ELFT>::Plt,<br>
> +       In<ELFT>::EhFrameHdr, In<ELFT>::VerSym,   In<ELFT>::VerNeed,<br>
> +       In<ELFT>::Dynamic});<br>
<br>
The comment is now out of date.<br>
<br>
> Index: ELF/Relocations.cpp<br>
> ==============================<wbr>==============================<wbr>=======<br>
> --- ELF/Relocations.cpp<br>
> +++ ELF/Relocations.cpp<br>
> @@ -479,8 +479,8 @@<br>
>    // See if this symbol is in a read-only segment. If so, preserve the symbol's<br>
>    // memory protection by reserving space in the .<a href="http://bss.rel.ro" rel="noreferrer" target="_blank">bss.rel.ro</a> section.<br>
>    bool IsReadOnly = isReadOnly<ELFT>(SS);<br>
> -  OutputSection *OSec = IsReadOnly ? Out::BssRelRo : Out::Bss;<br>
> -<br>
> +  OutputSection *OSec =<br>
> +      IsReadOnly ? In<ELFT>::BssRelRo->OutSec : In<ELFT>::Bss->OutSec;<br>
<br>
This is a bit odd. We create the In<ELFT>::BssRelRo and In<ELFT>::Bss,<br>
but they never hold anything. They are just a placeholder for output<br>
sections.<br>
<br>
I guess that instead of CopyRelSection it could be another<br>
SyntheticSection type that is explicitly just a placeholder for an<br>
output section.<br>
<br>
Not sure if that is worth it, but it should at least have a comment if<br>
we are to use CopyRelSection. Rui, what do you think?<br></blockquote><div><br></div><div>I think the current code works satisfactory, and this patch doesn't seems an improvement over it. </div></div></div></div>