<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/mac-linked clang crashes at runtime"
   href="https://bugs.llvm.org/show_bug.cgi?id=52427">52427</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld/mac-linked clang crashes at runtime
          </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>All
          </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>MachO
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>gkm@fb.com, jezreel@gmail.com, llvm-bugs@lists.llvm.org, smeenai@fb.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Repro file for linking clang:
<a href="https://drive.google.com/file/d/1uoZnBDRWrG6HQUsPzXsG5yA6t-I0zAoL/view?usp=sharing">https://drive.google.com/file/d/1uoZnBDRWrG6HQUsPzXsG5yA6t-I0zAoL/view?usp=sharing</a>

This is a clang that was built with -DLLVM_BUILD_INSTRUMENTED=IR.

Linking clang with the repro file with lld.ld64 and then running `bin/clang++
-target x86_64-unknown-unknown -O2 -g -std=c++14 -fno-exceptions -fno-rtti -w
-c pgo_training-1.ii pgo_training-1.ii` makes clang crash after ~25s.

clang doesn't crash if it's linked with ld64 (it succeeds after ~31s).

You can obtain pgo_training-1.ii by running `curl -L -O
<a href="https://commondatastorage.googleapis.com/chromium-browser-clang/pgo_training-1.ii">https://commondatastorage.googleapis.com/chromium-browser-clang/pgo_training-1.ii</a>`.




1: Full cmake invocation for producing the .o files:
```
 Running cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF
'-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld;clang-tools-extra;libcxx'
'-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;Mips;PowerPC;SystemZ;WebAssembly;X86'
-DLLVM_ENABLE_PIC=OFF -DLLVM_ENABLE_UNWIND_TABLES=OFF
-DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF
-DCLANG_PLUGIN_SUPPORT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF
-DCLANG_ENABLE_ARCMT=OFF '-DBUG_REPORT_URL=<a href="https://crbug.com">https://crbug.com</a> and run
tools/clang/scripts/process_crashreports.py (only works inside Google) which
will upload a report' -DLLVM_INCLUDE_GO_TESTS=OFF
-DENABLE_X86_RELAX_RELOCATIONS=NO -DLLVM_ENABLE_DIA_SDK=OFF
'-DCOMPILER_RT_SANITIZERS_TO_BUILD=asan;dfsan;msan;hwasan;tsan;cfi'
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DLIBCXX_ENABLE_SHARED=OFF
-DLIBCXX_ENABLE_STATIC=OFF -DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLLVM_ENABLE_LIBXML2=FORCE_ON
-DLLVM_ENABLE_LLD=ON '-DLLVM_ENABLE_PROJECTS=clang;libcxx;compiler-rt'
-DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS= -DCMAKE_EXE_LINKER_FLAGS=
-DCMAKE_SHARED_LINKER_FLAGS= -DCMAKE_MODULE_LINKER_FLAGS=
-DLLVM_BUILD_INSTRUMENTED=IR
-DCMAKE_C_COMPILER=/Users/thakis/src/chrome/src/third_party/llvm-bootstrap-install/bin/clang
-DCMAKE_CXX_COMPILER=/Users/thakis/src/chrome/src/third_party/llvm-bootstrap-install/bin/clang++
/Users/thakis/src/chrome/src/third_party/llvm/llvm
```
This is with a "normally" built clang as stage0 compiler, but it might repro
when just using system clang as host compiler.</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>