Closed emaste closed 7 years ago
While investigating a failure to link the FreeBSD EFI loader (described in a comment at https://reviews.llvm.org/D28313) I encountered a segfault.
(lldb) bt
llvm::DenseMapBase<llvm::DenseMap<lld::Atom const*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<lld::Atom const*>, llvm::detail::DenseSetPair<lld::Atom const*> >, lld::Atom const*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<lld::Atom const*>, llvm::detail::DenseSetPair<lld::Atom const*> >::initEmpty(this=0x00007fffffffcc20) + 80 at DenseMap.h:318 frame #​1: 0x00000000005a0e19 ld.lld
llvm::cast_convert_val<lld::coff::SectionChunk, lld::coff::Chunk*, lld::coff::Chunk*>::doit(Val=0x0000000804a48120) + 8 at Casting.h:199 frame #​3: 0x000000000058578b ld.lld
void std::__1::vector<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> >, std::__1::allocator<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> > > >::__push_back_slow_path<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> > >(this=0x00000008027cfc00, __x=0x00000008027cf800) + 174 at vector:1579 frame #​6: 0x00000000006304f6 ld.lld
std::__1::__function::__func<llvm::ExitOnError::ExitOnError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int)::'lambda'(llvm::Error const&), std::__1::allocator<llvm::ExitOnError::ExitOnError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int)::'lambda'(llvm::Error const&)>, int (llvm::Error const&)>::__clone() const [inlined] ~unique_ptr(this=0x00007fffffffcb80) at memory:2598 frame #​9: 0x0000000000630448 ld.lld
llvm::Triple::getOSTypeName(llvm::Triple::OSType) [inlined] StringRef(this=0x0000000000000000, Str=0x0000000000000000) + 14 at StringRef.h:83 frame #​11: 0x00000000004fb2bd ld.lld
parseFlavor(V=0x0000000804806df0) + 148 at lld.cpp:76 frame #​16: 0x0000000000464d5f ld.lld
Reproducer at https://people.freebsd.org/~emaste/lld/efi_loader.tar.
LLD version r291724.
Fixed by r291765
Extended Description
While investigating a failure to link the FreeBSD EFI loader (described in a comment at https://reviews.llvm.org/D28313) I encountered a segfault.
(lldb) bt
llvm::DenseMapBase<llvm::DenseMap<lld::Atom const*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<lld::Atom const*>, llvm::detail::DenseSetPair<lld::Atom const*> >, lld::Atom const*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<lld::Atom const*>, llvm::detail::DenseSetPair<lld::Atom const*> >::initEmpty(this=0x00007fffffffcc20) + 80 at DenseMap.h:318 frame #​1: 0x00000000005a0e19 ld.lld
lld::coff::SectionChunk::classof(C=0x0000000000000000) + 25 at Chunks.h:138 frame #2: 0x00000000005a0cd8 ld.lldllvm::cast_convert_val<lld::coff::SectionChunk, lld::coff::Chunk*, lld::coff::Chunk*>::doit(Val=0x0000000804a48120) + 8 at Casting.h:199 frame #​3: 0x000000000058578b ld.lld
void std::1::sort<lld::coff::fixupExports(first=0x297373622e283a6f, last=0x2e6568636163622f, comp=0x726564616f6c2f69)::$_0&, lld::coff::Export>(lld::coff::Export, lld::coff::Export*, lld::coff::fixupExports()::$_0&) + 1835 at algorithm:3935 frame #4: 0x00000000006251a2 ld.lld`void std::1::vector<std::1::vector<lld::coff::DefinedImportData*, std::1::allocator<lld::coff::DefinedImportData> >, std::1::allocator<std::1::vector<lld::coff::DefinedImportData, std::1::allocator<lld::coff::DefinedImportData*> > > >::push_back_slow_path<std::1::vector<lld::coff::DefinedImportData*, std::1::allocator<lld::coff::DefinedImportData> > >(std::__1::vector<lld::coff::DefinedImportData, std::1::allocator<lld::coff::DefinedImportData*> >&&) [inlined] std::1::vector<std::1::vector<lld::coff::DefinedImportData*, std::1::allocator<lld::coff::DefinedImportData> >, std::1::allocator<std::1::vector<lld::coff::DefinedImportData, std::1::allocator<lld::coff::DefinedImportData*> > > >::size(this=0x00000008027d6c00, this=0x000000080369a903, this=0x00007fffffffcb10, new_size=34401516544) const + 468 at vector:973 frame #5: 0x0000000000624fce ld.lldvoid std::__1::vector<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> >, std::__1::allocator<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> > > >::__push_back_slow_path<std::__1::vector<lld::coff::DefinedImportData*, std::__1::allocator<lld::coff::DefinedImportData*> > >(this=0x00000008027cfc00, __x=0x00000008027cf800) + 174 at vector:1579 frame #​6: 0x00000000006304f6 ld.lld
std::1::function::func<llvm::ExitOnError::ExitOnError(std::1::basic_string<char, std::1::char_traitsstd::__1::__function::__func<llvm::ExitOnError::ExitOnError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int)::'lambda'(llvm::Error const&), std::__1::allocator<llvm::ExitOnError::ExitOnError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int)::'lambda'(llvm::Error const&)>, int (llvm::Error const&)>::__clone() const [inlined] ~unique_ptr(this=0x00007fffffffcb80) at memory:2598 frame #​9: 0x0000000000630448 ld.lld
std::1::function::func<llvm::ExitOnError::ExitOnError(this=0x0000000000000000)::'lambda'(llvm::Error const&), std::1::allocator<llvm::ExitOnError::ExitOnError(std::1::basic_string<char, std::__1::char_traitsllvm::Triple::getOSTypeName(llvm::Triple::OSType) [inlined] StringRef(this=0x0000000000000000, Str=0x0000000000000000) + 14 at StringRef.h:83 frame #​11: 0x00000000004fb2bd ld.lld
llvm::Triple::getOSTypeName(Kind=UnknownOS) + 2541 at Triple.cpp:189 frame #12: 0x00000000004f47ba ld.lld`std::1::vector<unsigned short, std::1::allocatorparseFlavor(V=0x0000000804806df0) + 148 at lld.cpp:76 frame #​16: 0x0000000000464d5f ld.lld
_start(ap=Reproducer at https://people.freebsd.org/~emaste/lld/efi_loader.tar.
LLD version r291724.