<div dir="ltr">But if you do, please cherry pick r292940 too because this patch introduced a new issue of creating an invalid iterator.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 24, 2017 at 11:25 AM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That's OK.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 24, 2017 at 10:02 AM, 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"><br>
Thanks!<br>
<br>
I think we should port this to 4.0. Is that OK?<br>
<br>
Cheers,<br>
Rafael<br>
<div class="m_928487571923772705HOEnZb"><div class="m_928487571923772705h5"><br>
Peter Smith via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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-pr<wbr>oject?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/D2895<wbr>0</a><br>
><br>
> Modified:<br>
>     lld/trunk/ELF/SyntheticSectio<wbr>ns.cpp<br>
>     lld/trunk/test/ELF/basic-<wbr>mips.s<br>
>     lld/trunk/test/ELF/basic-ppc.<wbr>s<br>
><br>
> Modified: lld/trunk/ELF/SyntheticSection<wbr>s.cpp<br>
> URL: <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-pr<wbr>oject/lld/trunk/ELF/SyntheticS<wbr>ections.cpp?rev=292910&r1=<wbr>292909&r2=292910&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lld/trunk/ELF/SyntheticSection<wbr>s.cpp (original)<br>
> +++ lld/trunk/ELF/SyntheticSection<wbr>s.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 SymbolTableEntry &L,<br>
> -                                                  const SymbolTableEntry &R) {<br>
> -      return L.Symbol->symbol()->computeBin<wbr>ding() == STB_LOCAL &&<br>
> -             R.Symbol->symbol()->computeBi<wbr>nding() != STB_LOCAL;<br>
> -    });<br>
> +    auto It = std::stable_partition(<br>
> +        GlobBegin, Symbols.end(), [](const SymbolTableEntry &S) {<br>
> +          return S.Symbol->symbol()->computeBin<wbr>ding() == STB_LOCAL;<br>
> +        });<br>
> +    // update sh_info with number of Global symbols output with 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: <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-pr<wbr>oject/lld/trunk/test/ELF/basic<wbr>-mips.s?rev=292910&r1=292909&<wbr>r2=292910&view=diff</a><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: <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-pr<wbr>oject/lld/trunk/test/ELF/basic<wbr>-ppc.s?rev=292910&r1=292909&<wbr>r2=292910&view=diff</a><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" target="_blank">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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>