[llvm-bugs] [Bug 33032] New: ThinLTO + --gdb-index + --gc-sections leads to segfault in lld::elf::GdbIndexSection::writeTo

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 13 19:58:55 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33032

            Bug ID: 33032
           Summary: ThinLTO + --gdb-index + --gc-sections leads to
                    segfault in lld::elf::GdbIndexSection::writeTo
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at pcc.me.uk
                CC: llvm-bugs at lists.llvm.org

$ cat 1.c
_start() { yasm__xstrdup(); }
$ cat 2.c
void
yasm__xstrdup ()
{
}
$ clang -flto=thin -Os -g -c 1.c 2.c -w
$ ld.lld 1.o 2.o --gdb-index --gc-sections 
#0 0x0000000001e1f0ac llvm::sys::PrintStackTrace(llvm::raw_ostream&)
llvm/lib/Support/Unix/Signals.inc:398:5
#1 0x0000000001e1f259 PrintStackTraceSignalHandler(void*)
llvm/lib/Support/Unix/Signals.inc:462:1
#2 0x0000000001e1d893 llvm::sys::RunSignalHandlers()
llvm/lib/Support/Signals.cpp:44:5
#3 0x0000000001e1f89e SignalHandler(int)
llvm/lib/Support/Unix/Signals.inc:252:1
#4 0x00007f3f70386330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x000000000202dd4f lld::elf::GdbIndexSection::writeTo(unsigned char*)
llvm/tools/lld/ELF/SyntheticSections.cpp:1848:25
#6 0x0000000001f87ba7 void
lld::elf::InputSection::writeTo<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(unsigned char*) llvm/tools/lld/ELF/InputSection.cpp:642:5
#7 0x0000000001fcdd7f void
lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(unsigned char*)::{lambda(unsigned long)#1}::operator()(unsigned long)
const llvm/tools/lld/ELF/OutputSections.cpp:305:9
#8 0x0000000001fcdb62 std::_Function_handler<void (unsigned long), void
lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(unsigned char*)::{lambda(unsigned long)#1}>::_M_invoke(std::_Any_data
const&, unsigned long)
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2073:7
#9 0x0000000001f31528 std::function<void (unsigned long)>::operator()(unsigned
long) const
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:7
#10 0x0000000001f31a5e void
llvm::parallel::detail::parallel_for_each_n<unsigned long, std::function<void
(unsigned long)> >(unsigned long, unsigned long, std::function<void (unsigned
long)>)::{lambda()#2}::operator()() const
llvm/include/llvm/Support/Parallel.h:183:34
#11 0x0000000001f3184d std::_Function_handler<void (), void
llvm::parallel::detail::parallel_for_each_n<unsigned long, std::function<void
(unsigned long)> >(unsigned long, unsigned long, std::function<void (unsigned
long)>)::{lambda()#2}>::_M_invoke(std::_Any_data const&)
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2073:7
#12 0x0000000001e5049e std::function<void ()>::operator()() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:7
#13 0x0000000001e8752d
llvm::parallel::detail::TaskGroup::spawn(std::function<void
()>)::$_0::operator()() const llvm/lib/Support/Parallel.cpp:135:5
#14 0x0000000001e8730d std::_Function_handler<void (),
llvm::parallel::detail::TaskGroup::spawn(std::function<void
()>)::$_0>::_M_invoke(std::_Any_data const&)
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2073:7
#15 0x0000000001e5049e std::function<void ()>::operator()() const
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:2471:7
#16 0x0000000001e88d09 (anonymous namespace)::ThreadPoolExecutor::work()
llvm/lib/Support/Parallel.cpp:111:7
#17 0x0000000001e89ef8 (anonymous
namespace)::ThreadPoolExecutor::ThreadPoolExecutor(unsigned
int)::{lambda()#1}::operator()() const::{lambda()#1}::operator()() const
llvm/lib/Support/Parallel.cpp:80:35
#18 0x0000000001e89eb5 void std::_Bind_simple<(anonymous
namespace)::ThreadPoolExecutor::ThreadPoolExecutor(unsigned
int)::{lambda()#1}::operator()() const::{lambda()#1}
()>::_M_invoke<>(std::_Index_tuple<>)
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731:11
#19 0x0000000001e89e85 std::_Bind_simple<(anonymous
namespace)::ThreadPoolExecutor::ThreadPoolExecutor(unsigned
int)::{lambda()#1}::operator()() const::{lambda()#1} ()>::operator()()
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720:9
#20 0x0000000001e89e5c std::thread::_Impl<std::_Bind_simple<(anonymous
namespace)::ThreadPoolExecutor::ThreadPoolExecutor(unsigned
int)::{lambda()#1}::operator()() const::{lambda()#1} ()> >::_M_run()
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115:24
#21 0x00007f3f6f5cfa60 ~__shared_count
/build/gcc-4.8-mW1ufQ/gcc-4.8-4.8.4/build/x86_64-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:545:0
#22 0x00007f3f6f5cfa60 ~__shared_ptr
/build/gcc-4.8-mW1ufQ/gcc-4.8-4.8.4/build/x86_64-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:781:0
#23 0x00007f3f6f5cfa60 ~shared_ptr
/build/gcc-4.8-mW1ufQ/gcc-4.8-4.8.4/build/x86_64-linux-gnu/libstdc++-v3/include/bits/shared_ptr.h:93:0
#24 0x00007f3f6f5cfa60 execute_native_thread_routine
/build/gcc-4.8-mW1ufQ/gcc-4.8-4.8.4/build/x86_64-linux-gnu/libstdc++-v3/src/c++11/../../../../../src/libstdc++-v3/src/c++11/thread.cc:95:0
#25 0x00007f3f7037e184 start_thread
/build/eglibc-MjiXCM/eglibc-2.19/nptl/pthread_create.c:312:0
#26 0x00007f3f6f03dbed clone
/build/eglibc-MjiXCM/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113:0
Segmentation fault (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170514/27393295/attachment.html>


More information about the llvm-bugs mailing list