[lld] r292910 - [ELF] Correct sh_info for static symbol table

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 12:13:05 PST 2017


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?

On Tue, Jan 24, 2017 at 12:08 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

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


More information about the llvm-commits mailing list