<div dir="ltr">That's a bit larger than I was expecting. Overall it seems fine (as they are already submitted to trunk), but I'm not very confident that there is no regression. Is it possible to try to build FreeBSD base system with this patch to confirm that it still works?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 24, 2017 at 12:08 PM, Rafael Espíndola <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">Looks like the cleanest (no conflict) way to backport this is to port 4 patches:<br>
<br>
r292594: Do not crash when assign common symbol's values in script<br>
r292789: Stop handling local symbols in a special way.<br>
r292910: Correct sh_info for static symbol table<br>
r292940: Fixed crash after incrementing end iterator.<br>
<br>
r292594 is probably a good idea to port anyway. I can fix the<br>
conflicts and leave r292789 out if you want. A combined patch to 4.0<br>
is attached.<br>
<br>
Cheers,<br>
Rafael<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 24 January 2017 at 14:26, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> But if you do, please cherry pick r292940 too because this patch introduced<br>
> a new issue of creating an invalid iterator.<br>
><br>
> On Tue, Jan 24, 2017 at 11:25 AM, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
>><br>
>> That's OK.<br>
>><br>
>> On Tue, Jan 24, 2017 at 10:02 AM, Rafael Avila de Espindola<br>
>> <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>>><br>
>>><br>
>>> Thanks!<br>
>>><br>
>>> I think we should port this to 4.0. Is that OK?<br>
>>><br>
>>> Cheers,<br>
>>> Rafael<br>
>>><br>
>>> Peter Smith via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
>>><br>
>>> > Author: psmith<br>
>>> > Date: Tue Jan 24 04:43:40 2017<br>
>>> > New Revision: 292910<br>
>>> ><br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=292910&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=292910&view=rev</a><br>
>>> > Log:<br>
>>> > [ELF] Correct sh_info for static symbol table<br>
>>> ><br>
>>> > The sh_info field of the SHT_SYMTAB section holds the index for the<br>
>>> > first non-local symbol. When there are global symbols that are output<br>
>>> > with STB_LOCAL binding due to having hidden visibility or matching<br>
>>> > the local version from a version script, the calculated value of<br>
>>> > NumLocals + 1 does not account for them. This change accounts for<br>
>>> > global symbols being output with local binding.<br>
>>> ><br>
>>> > Differential Revision: <a href="https://reviews.llvm.org/D28950" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D28950</a><br>
>>> ><br>
>>> > Modified:<br>
>>> >     lld/trunk/ELF/<wbr>SyntheticSections.cpp<br>
>>> >     lld/trunk/test/ELF/basic-mips.<wbr>s<br>
>>> >     lld/trunk/test/ELF/basic-ppc.s<br>
>>> ><br>
>>> > Modified: lld/trunk/ELF/<wbr>SyntheticSections.cpp<br>
>>> > URL:<br>
>>> > <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=292910&r1=292909&r2=292910&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>SyntheticSections.cpp?rev=<wbr>292910&r1=292909&r2=292910&<wbr>view=diff</a><br>
>>> ><br>
>>> > ==============================<wbr>==============================<wbr>==================<br>
>>> > --- lld/trunk/ELF/<wbr>SyntheticSections.cpp (original)<br>
>>> > +++ lld/trunk/ELF/<wbr>SyntheticSections.cpp Tue Jan 24 04:43:40 2017<br>
>>> > @@ -1073,11 +1073,13 @@ template <class ELFT> void SymbolTableSe<br>
>>> ><br>
>>> >    if (!StrTabSec.isDynamic()) {<br>
>>> >      auto GlobBegin = Symbols.begin() + NumLocals;<br>
>>> > -    std::stable_sort(GlobBegin, Symbols.end(), [](const<br>
>>> > SymbolTableEntry &L,<br>
>>> > -                                                  const<br>
>>> > SymbolTableEntry &R) {<br>
>>> > -      return L.Symbol->symbol()-><wbr>computeBinding() == STB_LOCAL &&<br>
>>> > -             R.Symbol->symbol()-><wbr>computeBinding() != STB_LOCAL;<br>
>>> > -    });<br>
>>> > +    auto It = std::stable_partition(<br>
>>> > +        GlobBegin, Symbols.end(), [](const SymbolTableEntry &S) {<br>
>>> > +          return S.Symbol->symbol()-><wbr>computeBinding() == STB_LOCAL;<br>
>>> > +        });<br>
>>> > +    // update sh_info with number of Global symbols output with<br>
>>> > computed<br>
>>> > +    // binding of STB_LOCAL<br>
>>> > +    this->OutSec->Info = this->Info = 1 + It - Symbols.begin();<br>
>>> >      return;<br>
>>> >    }<br>
>>> ><br>
>>> ><br>
>>> > Modified: lld/trunk/test/ELF/basic-mips.<wbr>s<br>
>>> > URL:<br>
>>> > <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-mips.s?rev=292910&r1=292909&r2=292910&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>basic-mips.s?rev=292910&r1=<wbr>292909&r2=292910&view=diff</a><br>
>>> ><br>
>>> > ==============================<wbr>==============================<wbr>==================<br>
>>> > --- lld/trunk/test/ELF/basic-mips.<wbr>s (original)<br>
>>> > +++ lld/trunk/test/ELF/basic-mips.<wbr>s Tue Jan 24 04:43:40 2017<br>
>>> > @@ -176,7 +176,7 @@ __start:<br>
>>> >  # CHECK-NEXT:     Offset: 0x20010<br>
>>> >  # CHECK-NEXT:     Size: 48<br>
>>> >  # CHECK-NEXT:     Link: 10<br>
>>> > -# CHECK-NEXT:     Info: 1<br>
>>> > +# CHECK-NEXT:     Info: 2<br>
>>> >  # CHECK-NEXT:     AddressAlignment: 4<br>
>>> >  # CHECK-NEXT:     EntrySize: 16<br>
>>> >  # CHECK-NEXT:   }<br>
>>> ><br>
>>> > Modified: lld/trunk/test/ELF/basic-ppc.s<br>
>>> > URL:<br>
>>> > <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic-ppc.s?rev=292910&r1=292909&r2=292910&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>basic-ppc.s?rev=292910&r1=<wbr>292909&r2=292910&view=diff</a><br>
>>> ><br>
>>> > ==============================<wbr>==============================<wbr>==================<br>
>>> > --- lld/trunk/test/ELF/basic-ppc.s (original)<br>
>>> > +++ lld/trunk/test/ELF/basic-ppc.s Tue Jan 24 04:43:40 2017<br>
>>> > @@ -178,7 +178,7 @@<br>
>>> >  // CHECK-NEXT:     Offset: 0x2038<br>
>>> >  // CHECK-NEXT:     Size: 32<br>
>>> >  // CHECK-NEXT:     Link: 9<br>
>>> > -// CHECK-NEXT:     Info: 1<br>
>>> > +// CHECK-NEXT:     Info: 2<br>
>>> >  // CHECK-NEXT:     AddressAlignment: 4<br>
>>> >  // CHECK-NEXT:     EntrySize: 16<br>
>>> >  // CHECK-NEXT:     SectionData (<br>
>>> ><br>
>>> ><br>
>>> > ______________________________<wbr>_________________<br>
>>> > llvm-commits mailing list<br>
>>> > <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>>> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>