https://llvm.org/bugs/show_bug.cgi?id=31277
Bug ID: 31277 Summary: segfault Product: lld Version: unspecified Hardware: PC OS: FreeBSD Status: NEW Severity: normal Priority: P Component: ELF Assignee: unassignedb...@nondot.org Reporter: ema...@freebsd.org CC: llvm-bugs@lists.llvm.org Blocks: 23214 Classification: Unclassified Created attachment 17712 --> https://llvm.org/bugs/attachment.cgi?id=17712&action=edit crash reproducer Found while building FreeBSD HEAD with lld at r288670, crash is compiling the 32-bit compat version of ldd. The host is ~= FreeBSD 10.3. Excerpt from build log: --- ldd32.full --- cc -m32 -DCOMPAT_32BIT -march=i686 -mmmx -msse -msse2 -L/tank/emaste/obj/tank/emaste/src/freebsd-xlld/lib32/usr/lib32 --sysroot=/tank/emaste/obj/tank/emaste/src/freebsd-xlld/lib32 -B/tank/emaste/obj/tank/emaste/src/freebsd-xlld/tmp/usr/bin -B/tank/emaste/obj/tank/emaste/src/freebsd-xlld/lib32/usr/lib32 -O2 -pipe -g -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments -o ldd32.full ldd.o sods.o 0 ld 0x0000000000af130f llvm::raw_null_ostream::~raw_null_ostream() + 146783 1 ld 0x0000000000af1769 llvm::raw_null_ostream::~raw_null_ostream() + 147897 2 ld 0x0000000000aee5c7 llvm::raw_null_ostream::~raw_null_ostream() + 135191 3 ld 0x0000000000af1c6c llvm::raw_null_ostream::~raw_null_ostream() + 149180 4 libthr.so.3 0x0000000805327a3a pthread_sigmask + 1306 5 libthr.so.3 0x000000080532711c pthread_getspecific + 3580 cc: error: unable to execute command: Segmentation fault (core dumped) cc: error: linker command failed due to signal (use -v to see invocation) *** [ldd32.full] Error code 254 (lldb) Process 16354 stopped * thread #6: tid = 101141, 0x00000000005f538d ld.lld`unsigned int llvm::support::endian::read<unsigned int, (memory=0x0000000000000014)1, 2ul>(void const*) + 61 at Endian.h:52, stop reason = invalid address (fault address: 0x14) frame #0: 0x00000000005f538d ld.lld`unsigned int llvm::support::endian::read<unsigned int, (memory=0x0000000000000014)1, 2ul>(void const*) + 61 at Endian.h:52 49 value_type ret; 50 51 memcpy(&ret, -> 52 LLVM_ASSUME_ALIGNED(memory, 53 (detail::PickAlignment<value_type, alignment>::value)), 54 sizeof(value_type)); 55 return byte_swap<value_type, endian>(ret); (lldb) bt * thread #6: tid = 101141, 0x00000000005f538d ld.lld`unsigned int llvm::support::endian::read<unsigned int, (memory=0x0000000000000014)1, 2ul>(void const*) + 61 at Endian.h:52, stop reason = invalid address (fault address: 0x14) * frame #0: 0x00000000005f538d ld.lld`unsigned int llvm::support::endian::read<unsigned int, (memory=0x0000000000000014)1, 2ul>(void const*) + 61 at Endian.h:52 frame #1: 0x00000000005f5345 ld.lld`llvm::support::detail::packed_endian_specific_integral<unsigned int, (this=0x0000000000000014)1, 2ul>::operator unsigned int() const + 21 at Endian.h:180 frame #2: 0x00000000006786f6 ld.lld`llvm::object::ELFType<(Type=14, A=0, P=86204, Body=0x0000000807559258, Expr=R_TLS)1, false>::uint getSymVA<llvm::object::ELFType<(llvm::support::endianness)1, false> >(unsigned int, llvm::object::ELFType<(llvm::support::endianness)1, false>::uint, llvm::object::ELFType<(llvm::support::endianness)1, false>::uint, lld::elf::SymbolBody const&, lld::elf::RelExpr) + 1158 at InputSection.cpp:412 frame #3: 0x0000000000680381 ld.lld`lld::elf::InputSectionBase<llvm::object::ELFType<(this=0x0000000807621008, Buf=0x0000000806c870bc, BufEnd=0x0000000806c870c0)1, false> >::relocate(unsigned char*, unsigned char*) + 801 at InputSection.cpp:540 frame #4: 0x0000000000886c0c ld.lld`lld::elf::GotSection<llvm::object::ELFType<(this=0x0000000807621000, Buf=0x0000000806c870bc)1, false> >::writeTo(unsigned char*) + 60 at SyntheticSections.h:427 frame #5: 0x000000000068ceea ld.lld`lld::elf::InputSection<llvm::object::ELFType<(this=0x0000000807621008, Buf=0x0000000806c870bc)1, false> >::writeTo(unsigned char*) + 106 at InputSection.cpp:580 frame #6: 0x0000000000819ca0 ld.lld`operator(this=0x00007fffdf9fabd8, IS=0x0000000807621008) + 32 at OutputSections.cpp:256 frame #7: 0x000000000081b9cc ld.lld`operator() [inlined] lld::elf::OutputSection<llvm::object::ELFType<(__first=__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<1, false> > **> at 0x00007fffdf9fabe8, __last=__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<1, false> > **> at 0x00007fffdf9fabe0, __f=lld::elf::OutputSection<llvm::object::ELFType<llvm::support::endianness, false> >::<anonymous class> at 0x00007fffdf9fabd8)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*) std::__1::for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)) + 93 at algorithm:853 frame #8: 0x000000000081b96f ld.lld`operator(this=0x0000000808410078) + 191 at Parallel.h:307 frame #9: 0x000000000081b89c ld.lld`std::__1::__function::__func<void lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*))::'lambda'(), std::__1::allocator<void lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*))::'lambda'()>, void ()>::operator()() [inlined] decltype(this=0x0000000808410078, __f=0x0000000808410078)1, false> >**> >(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<void lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*))::'lambda'()&>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>&&) + 60 at __functional_base:413 frame #10: 0x000000000081b88b ld.lld`std::__1::__function::__func<void lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(this=0x0000000808410070)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*))::'lambda'(), std::__1::allocator<void lld::parallel_for_each<std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*)>(std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, std::__1::__wrap_iter<lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >**>, lld::elf::OutputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >::writeTo(unsigned char*)::'lambda'(lld::elf::InputSection<llvm::object::ELFType<(llvm::support::endianness)1, false> >*))::'lambda'()>, void ()>::operator()() + 43 at functional:1370 frame #11: 0x00000000004e2bba ld.lld`std::__1::function<void (this=0x0000000808410070)>::operator()() const + 26 at functional:1756 frame #12: 0x00000000004e2b8d ld.lld`operator(this=0x0000000808410070) + 29 at Parallel.h:189 frame #13: 0x00000000004e2b5c ld.lld`std::__1::__function::__func<lld::TaskGroup::spawn(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<lld::TaskGroup::spawn(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] decltype(this=0x0000000808410070, __f=0x0000000808410070)>)::'lambda'()&>(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<lld::TaskGroup::spawn(std::__1::function<void ()>)::'lambda'()&>(lld::TaskGroup::spawn(std::__1::function<void ()>)::'lambda'()&&&) + 60 at __functional_base:413 frame #14: 0x00000000004e2b4b ld.lld`std::__1::__function::__func<lld::TaskGroup::spawn(this=0x0000000808410060)>)::'lambda'(), std::__1::allocator<lld::TaskGroup::spawn(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() + 43 at functional:1370 frame #15: 0x00000000004e2bba ld.lld`std::__1::function<void (this=0x00007fffdf9fad70)>::operator()() const + 26 at functional:1756 frame #16: 0x00000000004e849f ld.lld`lld::internal::ThreadPoolExecutor::work(this=0x00000000054bba90) + 527 at Parallel.h:160 frame #17: 0x00000000004e8cf8 ld.lld`operator(this=0x000000080780e070) + 24 at Parallel.h:126 frame #18: 0x00000000004e8be7 ld.lld`std::__1::__thread_proxy<std::__1::tuple<lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(unsigned int)::'lambda'()::operator()() const::'lambda'()> >(void*, void*) [inlined] std::__1::__invoke<lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(__f=0x000000080780e070)::'lambda'()::operator()() const::'lambda'()>(decltype(std::__1::forward<lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(unsigned int)::'lambda'()::operator()() const::'lambda'()>(fp)(std::__1::forward<>(fp0))), lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(unsigned int)::'lambda'()::operator()() const::'lambda'()&&) + 17 at __functional_base:413 frame #19: 0x00000000004e8bd6 ld.lld`std::__1::__thread_proxy<std::__1::tuple<lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(unsigned int)::'lambda'()::operator()() const::'lambda'()> >(void*, void*) [inlined] _ZNSt3__116__thread_executeIZZN3lld8internal18ThreadPoolExecutorC1EjENKUlvE_clEvEUlvE_JEJEEEvRNS_5tupleIJT_DpT0_EEENS_15__tuple_indicesIJXspT1_EEEE(__t=0x000000080780e070, (null)=__tuple_indices<> at 0x00007fffdf9faf78) + 32 at thread:337 frame #20: 0x00000000004e8bb6 ld.lld`std::__1::__thread_proxy<std::__1::tuple<lld::internal::ThreadPoolExecutor::ThreadPoolExecutor(__vp=0x000000080780e070)::'lambda'()::operator()() const::'lambda'()> >(void*, void*) + 262 at thread:347 frame #21: 0x0000000805322755 libthr.so.3`thread_start(curthread=0x0000000807810c00) + 293 at thr_create.c:288 -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs