[lld] r315721 - Handle shared and lazy symbol in the gnu hash construction.

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 14 07:05:25 PDT 2017


Reverted in r315803.

Build clang and lld, configure libcxx with -fuse-ld=lld, and run
check-libcxx.
I have no idea about repository layout ;)

On Sat, Oct 14, 2017 at 3:00 PM Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Sorry about that. Feel free to revert.
>
> I can try to reproduce it on Monday? What do I have to do, just checkout
> libc++ in llvm/projects?
>
> Cheers,
> Rafael
>
> NAKAMURA Takumi <geek4civic at gmail.com> writes:
>
> > It broke stage2-libc++.so (built by stage1-clang and stage1-lld). I am
> > investigating.
> > http://bb9.pgr.jp/#/builders/20/builds/94
> >
> > On Sat, Oct 14, 2017 at 3:07 AM Rafael Espindola via llvm-commits <
> > llvm-commits at lists.llvm.org> wrote:
> >
> >> Author: rafael
> >> Date: Fri Oct 13 11:07:11 2017
> >> New Revision: 315721
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=315721&view=rev
> >> Log:
> >> Handle shared and lazy symbol in the gnu hash construction.
> >>
> >> We were not considering those symbols undefined and they could end up
> >> in the end of the dynamic symbol table.
> >>
> >> Modified:
> >>     lld/trunk/ELF/SyntheticSections.cpp
> >>     lld/trunk/test/ELF/gc-sections-shared.s
> >>     lld/trunk/test/ELF/gnu-hash-table.s
> >>
> >> Modified: lld/trunk/ELF/SyntheticSections.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=315721&r1=315720&r2=315721&view=diff
> >>
> >>
> ==============================================================================
> >> --- lld/trunk/ELF/SyntheticSections.cpp (original)
> >> +++ lld/trunk/ELF/SyntheticSections.cpp Fri Oct 13 11:07:11 2017
> >> @@ -1608,7 +1608,7 @@ void GnuHashTableSection::addSymbols(std
> >>    // its type correctly.
> >>    std::vector<SymbolTableEntry>::iterator Mid =
> >>        std::stable_partition(V.begin(), V.end(), [](const
> SymbolTableEntry
> >> &S) {
> >> -        return S.Symbol->isUndefined();
> >> +        return !S.Symbol->isInCurrentDSO();
> >>        });
> >>    if (Mid == V.end())
> >>      return;
> >>
> >> Modified: lld/trunk/test/ELF/gc-sections-shared.s
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gc-sections-shared.s?rev=315721&r1=315720&r2=315721&view=diff
> >>
> >>
> ==============================================================================
> >> --- lld/trunk/test/ELF/gc-sections-shared.s (original)
> >> +++ lld/trunk/test/ELF/gc-sections-shared.s Fri Oct 13 11:07:11 2017
> >> @@ -19,16 +19,16 @@
> >>  # CHECK-NEXT:     Section: Undefined (0x0)
> >>  # CHECK-NEXT:   }
> >>  # CHECK-NEXT:   Symbol {
> >> -# CHECK-NEXT:     Name: bar
> >> +# CHECK-NEXT:     Name: bar2
> >>  # CHECK-NEXT:     Value:
> >>  # CHECK-NEXT:     Size:
> >>  # CHECK-NEXT:     Binding: Global
> >>  # CHECK-NEXT:     Type:
> >>  # CHECK-NEXT:     Other:
> >> -# CHECK-NEXT:     Section: .text
> >> +# CHECK-NEXT:     Section: Undefined
> >>  # CHECK-NEXT:   }
> >>  # CHECK-NEXT:   Symbol {
> >> -# CHECK-NEXT:     Name: foo
> >> +# CHECK-NEXT:     Name: bar
> >>  # CHECK-NEXT:     Value:
> >>  # CHECK-NEXT:     Size:
> >>  # CHECK-NEXT:     Binding: Global
> >> @@ -37,13 +37,13 @@
> >>  # CHECK-NEXT:     Section: .text
> >>  # CHECK-NEXT:   }
> >>  # CHECK-NEXT:   Symbol {
> >> -# CHECK-NEXT:     Name: bar2
> >> +# CHECK-NEXT:     Name: foo
> >>  # CHECK-NEXT:     Value:
> >>  # CHECK-NEXT:     Size:
> >>  # CHECK-NEXT:     Binding: Global
> >>  # CHECK-NEXT:     Type:
> >>  # CHECK-NEXT:     Other:
> >> -# CHECK-NEXT:     Section: Undefined
> >> +# CHECK-NEXT:     Section: .text
> >>  # CHECK-NEXT:   }
> >>  # CHECK-NEXT: ]
> >>
> >>
> >> Modified: lld/trunk/test/ELF/gnu-hash-table.s
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-hash-table.s?rev=315721&r1=315720&r2=315721&view=diff
> >>
> >>
> ==============================================================================
> >> --- lld/trunk/test/ELF/gnu-hash-table.s (original)
> >> +++ lld/trunk/test/ELF/gnu-hash-table.s Fri Oct 13 11:07:11 2017
> >> @@ -6,10 +6,29 @@
> >>  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux    %s    -o
> >> %t-x86_64.o
> >>  # RUN: llvm-mc -filetype=obj -triple=powerpc64-pc-linux %s    -o
> >> %t-ppc64.o
> >>
> >> +# RUN: echo ".global zed; zed:" > %t2.s
> >> +# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux      %t2.s -o
> >> %t2-i386.o
> >> +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux    %t2.s -o
> >> %t2-x86_64.o
> >> +# RUN: llvm-mc -filetype=obj -triple=powerpc64-pc-linux %t2.s -o
> >> %t2-ppc64.o
> >> +
> >> +# RUN: rm -f %t2-i386.a %t2-x86_64.a %t2-ppc64.a
> >> +# RUN: llvm-ar rc %t2-i386.a %t2-i386.o
> >> +# RUN: llvm-ar rc %t2-x86_64.a %t2-x86_64.o
> >> +# RUN: llvm-ar rc %t2-ppc64.a %t2-ppc64.o
> >> +
> >> +# RUN: echo ".global xyz; xyz:" > %t3.s
> >> +# RUN: llvm-mc -filetype=obj -triple=i386-pc-linux      %t3.s -o
> >> %t3-i386.o
> >> +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux    %t3.s -o
> >> %t3-x86_64.o
> >> +# RUN: llvm-mc -filetype=obj -triple=powerpc64-pc-linux %t3.s -o
> >> %t3-ppc64.o
> >> +
> >> +# RUN: ld.lld -shared %t3-i386.o   -o %t3-i386.so
> >> +# RUN: ld.lld -shared %t3-x86_64.o -o %t3-x86_64.so
> >> +# RUN: ld.lld -shared %t3-ppc64.o  -o %t3-ppc64.so
> >> +
> >>  # RUN: ld.lld -shared --hash-style=gnu  -o %te-i386.so  %te-i386.o
> >> -# RUN: ld.lld -shared  -hash-style=gnu  -o %t-i386.so   %t-i386.o
> >> -# RUN: ld.lld -shared  -hash-style=gnu  -o %t-x86_64.so %t-x86_64.o
> >> -# RUN: ld.lld -shared --hash-style both -o %t-ppc64.so  %t-ppc64.o
> >> +# RUN: ld.lld -shared  -hash-style=gnu  -o %t-i386.so   %t-i386.o
> >>  %t2-i386.a   %t3-i386.so
> >> +# RUN: ld.lld -shared  -hash-style=gnu  -o %t-x86_64.so %t-x86_64.o
> >> %t2-x86_64.a %t3-x86_64.so
> >> +# RUN: ld.lld -shared --hash-style both -o %t-ppc64.so  %t-ppc64.o
> >> %t2-ppc64.a  %t3-ppc64.so
> >>
> >>  # RUN: llvm-readobj -dyn-symbols -gnu-hash-table %te-i386.so \
> >>  # RUN:   | FileCheck %s -check-prefix=EMPTY
> >> @@ -70,6 +89,16 @@
> >>  # I386:          Section: Undefined
> >>  # I386:        }
> >>  # I386:        Symbol {
> >> +# I386:          Name: xyz@
> >> +# I386:          Binding: Global
> >> +# I386:          Section: Undefined
> >> +# I386:        }
> >> +# I386:        Symbol {
> >> +# I386:          Name: zed@
> >> +# I386:          Binding: Weak
> >> +# I386:          Section: Undefined
> >> +# I386:        }
> >> +# I386:        Symbol {
> >>  # I386:          Name: bar@
> >>  # I386:          Binding: Global
> >>  # I386:          Section: .text
> >> @@ -82,11 +111,11 @@
> >>  # I386:      ]
> >>  # I386:      GnuHashTable {
> >>  # I386-NEXT:   Num Buckets: 1
> >> -# I386-NEXT:   First Hashed Symbol Index: 2
> >> +# I386-NEXT:   First Hashed Symbol Index: 4
> >>  # I386-NEXT:   Num Mask Words: 1
> >>  # I386-NEXT:   Shift Count: 5
> >>  # I386-NEXT:   Bloom Filter: [0x14000220]
> >> -# I386-NEXT:   Buckets: [2]
> >> +# I386-NEXT:   Buckets: [4]
> >>  # I386-NEXT:   Values: [0xB8860BA, 0xB887389]
> >>  # I386-NEXT: }
> >>
> >> @@ -120,6 +149,16 @@
> >>  # X86_64:          Section: Undefined
> >>  # X86_64:        }
> >>  # X86_64:        Symbol {
> >> +# X86_64:          Name: xyz@
> >> +# X86_64:          Binding: Global
> >> +# X86_64:          Section: Undefined
> >> +# X86_64:        }
> >> +# X86_64:        Symbol {
> >> +# X86_64:          Name: zed@
> >> +# X86_64:          Binding: Weak
> >> +# X86_64:          Section: Undefined
> >> +# X86_64:        }
> >> +# X86_64:        Symbol {
> >>  # X86_64:          Name: bar@
> >>  # X86_64:          Binding: Global
> >>  # X86_64:          Section: .text
> >> @@ -132,11 +171,11 @@
> >>  # X86_64:      ]
> >>  # X86_64:      GnuHashTable {
> >>  # X86_64-NEXT:   Num Buckets: 1
> >> -# X86_64-NEXT:   First Hashed Symbol Index: 2
> >> +# X86_64-NEXT:   First Hashed Symbol Index: 4
> >>  # X86_64-NEXT:   Num Mask Words: 1
> >>  # X86_64-NEXT:   Shift Count: 6
> >>  # X86_64-NEXT:   Bloom Filter: [0x400000000004204]
> >> -# X86_64-NEXT:   Buckets: [2]
> >> +# X86_64-NEXT:   Buckets: [4]
> >>  # X86_64-NEXT:   Values: [0xB8860BA, 0xB887389]
> >>  # X86_64-NEXT: }
> >>
> >> @@ -170,6 +209,16 @@
> >>  # PPC64:          Section: Undefined
> >>  # PPC64:        }
> >>  # PPC64:        Symbol {
> >> +# PPC64:          Name: xyz@
> >> +# PPC64:          Binding: Global
> >> +# PPC64:          Section: Undefined
> >> +# PPC64:        }
> >> +# PPC64:        Symbol {
> >> +# PPC64:          Name: zed@
> >> +# PPC64:          Binding: Weak
> >> +# PPC64:          Section: Undefined
> >> +# PPC64:        }
> >> +# PPC64:        Symbol {
> >>  # PPC64:          Name: bar@
> >>  # PPC64:          Binding: Global
> >>  # PPC64:          Section: .text
> >> @@ -182,14 +231,16 @@
> >>  # PPC64:      ]
> >>  # PPC64:      GnuHashTable {
> >>  # PPC64-NEXT:   Num Buckets: 1
> >> -# PPC64-NEXT:   First Hashed Symbol Index: 2
> >> +# PPC64-NEXT:   First Hashed Symbol Index: 4
> >>  # PPC64-NEXT:   Num Mask Words: 1
> >>  # PPC64-NEXT:   Shift Count: 6
> >>  # PPC64-NEXT:   Bloom Filter: [0x400000000004204]
> >> -# PPC64-NEXT:   Buckets: [2]
> >> +# PPC64-NEXT:   Buckets: [4]
> >>  # PPC64-NEXT:   Values: [0xB8860BA, 0xB887389]
> >>  # PPC64-NEXT: }
> >>
> >>  .globl foo,bar,baz
> >>  foo:
> >>  bar:
> >> +.weak zed
> >> +.global xyz
> >>
> >>
> >> _______________________________________________
> >> 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/20171014/72921879/attachment.html>


More information about the llvm-commits mailing list