<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 - llvm-libtool-darwin doesn't support (Thin)LTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=52035">52035</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-libtool-darwin doesn't support (Thin)LTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llvm-ar
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>phosek@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I tried using llvm-libtool-darwin in (Thin)LTO build to avoid the dependency on
libLTO.dylib on Darwin but the tool fails with assertion failure:

Assertion failed: (T && T->hasMCAsmParser()), function
initializeRecordStreamer, file
/Users/phosek/llvm/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp, line 82.
Stack dump:
0  llvm-libtool-darwin      0x00000001062033a7
llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  llvm-libtool-darwin      0x00000001062022e8 llvm::sys::RunSignalHandlers() +
248
2  llvm-libtool-darwin      0x00000001062039d0 SignalHandler(int) + 272
3  libsystem_platform.dylib 0x00007fff2036dd7d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339975697056
5  libsystem_c.dylib        0x00007fff2027d406 abort + 125
6  libsystem_c.dylib        0x00007fff2027c7d8 err + 0
7  llvm-libtool-darwin      0x000000010631e2f1
initializeRecordStreamer(llvm::Module const&, llvm::function_ref<void
(llvm::RecordStreamer&)>) (.cold.1) + 33
8  llvm-libtool-darwin      0x00000001061727f3
initializeRecordStreamer(llvm::Module const&, llvm::function_ref<void
(llvm::RecordStreamer&)>) + 1891
9  llvm-libtool-darwin      0x0000000106172050
llvm::ModuleSymbolTable::addModule(llvm::Module*) + 992
10 llvm-libtool-darwin      0x000000010615485b
llvm::object::IRObjectFile::create(llvm::MemoryBufferRef, llvm::LLVMContext&) +
1291
11 llvm-libtool-darwin      0x0000000105ffc90d
verifyAndAddIRObject(std::__1::map<unsigned long long,
std::__1::vector<llvm::NewArchiveMember,
std::__1::allocator<llvm::NewArchiveMember> >, std::__1::less<unsigned long
long>, std::__1::allocator<std::__1::pair<unsigned long long const,
std::__1::vector<llvm::NewArchiveMember,
std::__1::allocator<llvm::NewArchiveMember> > > > >&, llvm::NewArchiveMember,
Config const&) + 109
12 llvm-libtool-darwin      0x0000000105ff8a18 main + 6264
13 libdyld.dylib            0x00007fff20343f3d start + 1
14 libdyld.dylib            0x0000000000000090 start + 18446603339975868756

To reproduce this issue, I used the following steps:

$ mkdir /Users/phosek/llvm/build/stage1 && cd /Users/phosek/llvm/build/stage1
$ cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="clang;lld;llvm" \
../../llvm-project/llvm
$ ninja clang lld LTO llvm-symbolizer
$ mkdir /Users/phosek/llvm/build/stage2 && cd /Users/phosek/llvm/build/stage2
$ cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_C_COMPILER=/Users/phosek/llvm/build/stage1/bin/clang \
-DCMAKE_CXX_COMPILER=/Users/phosek/llvm/build/stage1/bin/clang++ \
-DCMAKE_LIBTOOL=/Users/phosek/llvm/build/stage1/bin/llvm-libtool-darwin \
-DLLVM_ENABLE_PROJECTS="clang;lld;llvm" \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_ENABLE_LTO=ON \
../../llvm-project/llvm
$ ninja check-llvm

This reproduces with both LTO and ThinLTO.</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>