<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 - BugPoint tests are failing when compiled with LTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=51230">51230</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BugPoint tests are failing when compiled with LTO
          </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>phosek@chromium.org
          </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>I tried enabling the use of ld64.lld in our toolchain build that uses (regular)
LTO but I see a number of BugPoint tests failure which all looks the same:

```
Error opening
'/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/stage2-bins/lib/BugpointPasses.dylib':
dlopen(/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/stage2-bins/lib/BugpointPasses.dylib,
9): Symbol not found: __ZNK4llvm4Pass11getPassNameEv
  Referenced from:
/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/stage2-bins/lib/BugpointPasses.dylib
  Expected in: flat namespace
 in
/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/stage2-bins/lib/BugpointPasses.dylib
  -load request ignored.
bugpoint: Unknown command line argument '-bugpoint-crashcalls'.  Try:
'/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/stage2-bins/bin/bugpoint
--help'
bugpoint: Did you mean '--print-after-all'?
```

I suspect it's related to the use of -flat_namespace, see
<a href="https://github.com/llvm/llvm-project/blob/e69a8c42135606e60446d5e78144357a9e429c77/llvm/cmake/modules/HandleLLVMOptions.cmake#L174">https://github.com/llvm/llvm-project/blob/e69a8c42135606e60446d5e78144357a9e429c77/llvm/cmake/modules/HandleLLVMOptions.cmake#L174</a>,
which should be supported under LTO according to
<a href="https://github.com/llvm/llvm-project/blob/d7d2e4545e6b04ea29ffd05ebef2f7c26590b925/lld/MachO/LTO.cpp#L83">https://github.com/llvm/llvm-project/blob/d7d2e4545e6b04ea29ffd05ebef2f7c26590b925/lld/MachO/LTO.cpp#L83</a>
but perhaps it doesn't behave the same way as ld64?</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>