<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 - Linking with lld causes MCJIT to fail at runtime with 'JIT has not been linked in'."
   href="https://bugs.llvm.org/show_bug.cgi?id=49123">49123</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linking with lld causes MCJIT to fail at runtime with 'JIT has not been linked in'.
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lukas.bergdoll@mvtec.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>System: x64
OS: Linux 5.10.12-arch1-1

LLVM version: 10.0.0

A project that does among other things:

```
InitializeNativeTarget();
InitializeNativeTargetAsmPrinter();
InitializeNativeTargetAsmParser();

LLVMLinkInMCJIT();

[...]

std::string error_msg;
auto exec_engine = EngineBuilder(std::unique_ptr<Module>(mod))
    .setErrorStr(&error_msg)
    .setEngineKind(EngineKind::JIT)
    .create();
```

When using the system ld linker, the EngineBuilder create call works as
expected and produces a functioning MCJIT. However when changing CMake settings
to use lld:

```
-D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
-D CMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" \
-D CMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
```

`exec_engine` is now a nullptr, and `error_msg` is 'JIT has not been linked
in'.

---

>From what I can tell the only difference is lld, and it claims to be a drop in
replacement which it fails to be here.</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>