<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ThinLTO + --gdb-index + --gc-sections leads to segfault in lld::elf::GdbIndexSection::writeTo"
   href="https://bugs.llvm.org/show_bug.cgi?id=33032">33032</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ThinLTO + --gdb-index + --gc-sections leads to segfault in lld::elf::GdbIndexSection::writeTo
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter@pcc.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>