<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 - lld hangs in pthread_cond_wait@@GLIBC_2.3.2 ()"
   href="https://bugs.llvm.org/show_bug.cgi?id=34806">34806</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld hangs in pthread_cond_wait@@GLIBC_2.3.2 ()
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jr98@hotmail.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hello,

i have the problem that lld hangs about half the time.

You can find a coredump at: <a href="https://gitlab.com/snsmac/lld-hang">https://gitlab.com/snsmac/lld-hang</a>

Im not sure, but i think the bug was introduced after Sep 23, 2017


Stacktrace:
 #0  pthread_cond_wait@@GLIBC_2.3.2 () at
../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f5d243bc80c in __gthread_cond_wait (__mutex=<optimized out>,
__cond=<optimized out>)
    at
/build/gcc-6-TDW5sa/gcc-6-6.3.0/build/x86_64-linux-gnu/libstdc++-v3/include/x86_64-linux-gnu/bits/gthr-default.h:864
#2  std::condition_variable::wait (this=<optimized out>, __lock=...) at
../../../../../src/libstdc++-v3/src/c++11/condition_variable.cc:53
#3  0x00000000005b83c1 in
std::condition_variable::wait<llvm::parallel::detail::Latch::sync()
const::{lambda()#1}>(std::unique_lock<std::mutex>&,
llvm::parallel::detail::Latch::sync() const::{lambda()#1})
(this=0x7ffc2925f2d8, __lock=..., __p=...) at
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/condition_variable:99
#4  0x00000000005b82fe in llvm::parallel::detail::Latch::sync
(this=0x7ffc2925f2a8) at
/home/jr/src/clang-build/llvm/include/llvm/Support/Parallel.h:71
#5  0x00000000005b8269 in llvm::parallel::detail::Latch::~Latch
(this=0x7ffc2925f2a8) at
/home/jr/src/clang-build/llvm/include/llvm/Support/Parallel.h:56
#6  0x00000000005b81f5 in llvm::parallel::detail::TaskGroup::~TaskGroup
(this=0x7ffc2925f2a8) at
/home/jr/src/clang-build/llvm/include/llvm/Support/Parallel.h:75
#7  0x0000000000821b88 in
llvm::parallel::detail::parallel_for_each<__gnu_cxx::__normal_iterator<lld::elf::OutputSection**,
std::vector<lld::elf::OutputSection*, std::allocator<lld::elf::OutputSection*>
<span class="quote">> >, (anonymous</span >
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}>(__gnu_cxx::__normal_iterator<lld::elf::OutputSection**,</span >
std::vector<lld::elf::OutputSection*, std::allocator<lld::elf::OutputSection*>
<span class="quote">> >, (anonymous</span >
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}, (anonymous</span >
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}) (Begin=0x6002320, </span >
    End=0x5ee1850, Fn=...) at
/home/jr/src/clang-build/llvm/include/llvm/Support/Parallel.h:166
#8  0x000000000082191d in
llvm::parallel::for_each<__gnu_cxx::__normal_iterator<lld::elf::OutputSection**,
std::vector<lld::elf::OutputSection*, std::allocator<lld::elf::OutputSection*>
<span class="quote">> >, (anonymous</span >
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}>(llvm::parallel::parallel_execution_policy,</span >
__gnu_cxx::__normal_iterator<lld::elf::OutputSection**,
std::vector<lld::elf::OutputSection*, std::allocator<lld::elf::OutputSection*>
<span class="quote">> >, llvm::parallel::parallel_execution_policy, (anonymous</span >
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}) (policy=...,</span >
Begin=0x5fff0c0, End=0x5ee1850, Fn=...)
    at /home/jr/src/clang-build/llvm/include/llvm/Support/Parallel.h:234
#9  0x00000000008210da in
lld::elf::parallelForEach<std::vector<lld::elf::OutputSection*,
std::allocator<lld::elf::OutputSection*> >&, (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}>(std::vector<lld::elf::OutputSection*,</span >
std::allocator<lld::elf::OutputSection*> >&, (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections()::{lambda(lld::elf::OutputSection*)#2}) (Range=std::vector of</span >
length 43, capacity 64 = {...}, Fn=...)
    at /home/jr/src/clang-build/llvm/tools/lld/ELF/Threads.h:72
#10 0x0000000000819735 in (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::writeSections (this=0x7ffc2925f5b0)</span >
    at /home/jr/src/clang-build/llvm/tools/lld/ELF/Writer.cpp:1917
#11 0x00000000007f6409 in (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">>::run (this=0x7ffc2925f5b0)</span >
    at /home/jr/src/clang-build/llvm/tools/lld/ELF/Writer.cpp:231
#12 0x000000000082f585 in
lld::elf::writeResult<llvm::object::ELFType<(llvm::support::endianness)1, true>
<span class="quote">> () at /home/jr/src/clang-build/llvm/tools/lld/ELF/Writer.cpp:123</span >
#13 0x0000000000643c00 in
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> > (this=0x5daf7c0, Args=...)
    at /home/jr/src/clang-build/llvm/tools/lld/ELF/Driver.cpp:1109
#14 0x00000000006309f2 in lld::elf::LinkerDriver::main (this=0x5daf7c0,
ArgsArr=..., CanExitEarly=true) at
/home/jr/src/clang-build/llvm/tools/lld/ELF/Driver.cpp:394
#15 0x000000000062ff1c in lld::elf::link (Args=..., CanExitEarly=true,
Error=...) at /home/jr/src/clang-build/llvm/tools/lld/ELF/Driver.cpp:91
#16 0x0000000000476517 in main (Argc=35, Argv=0x7ffc29260558) at
/home/jr/src/clang-build/llvm/tools/lld/tools/lld/lld.cpp:116

Invocation: 
clang++ -v  -fprofile-instr-generate -fcoverage-mapping -fuse-ld=lld -fPIC -o
test main.o 
clang version 6.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
4e0b56c202361f464daadc14e860a7842f7edbb2) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
5295aa52c19464921cd5557547d265ed75619889)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/local/bin/ld.lld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o test
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0
-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../.. -L/usr/local/bin/../lib -L/lib
-L/usr/lib main.o -u__llvm_profile_runtime
/usr/local/lib/clang/6.0.0/lib/linux/libclang_rt.profile-x86_64.a -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/6.3.0/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../x86_64-linux-gnu/crtn.o
^C


clang++ --version
clang version 6.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
4e0b56c202361f464daadc14e860a7842f7edbb2) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
5295aa52c19464921cd5557547d265ed75619889)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin



I build llvm/clang/rt/lld withthe following command:
       mkdir clang-build \ 
    && cd clang-build \
    && git clone --depth 1 <a href="https://llvm.org/git/llvm.git">https://llvm.org/git/llvm.git</a> \
    && cd llvm/tools/ \
    && git clone --depth 1 <a href="https://llvm.org/git/clang.git">https://llvm.org/git/clang.git</a> \
    && git clone --depth 1 <a href="https://llvm.org/git/lld.git">https://llvm.org/git/lld.git</a> \
    && cd .. \
    && cd projects \
    && git clone --depth 1 <a href="https://llvm.org/git/compiler-rt.git">https://llvm.org/git/compiler-rt.git</a> \
    && cd .. \
    && cd .. \
    && mkdir build \
    && cd build/ \
    && cmake -G Ninja -DLLVM_ENABLE_RTTI=ON -DLLVM_ENABLE_EH=ON  
-DCLANG_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_GO_TESTS=OFF
-DCOMPILER_RT_INCLUDE_TESTS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON 
-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86
-DCMAKE_C_COMPILER=/usr/bin/clang-4.0 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-4.0
../llvm/ \
    && ninja \
    && ninja install</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>