[llvm-bugs] [Bug 49123] New: Linking with lld causes MCJIT to fail at runtime with 'JIT has not been linked in'.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 10 02:03:42 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49123

            Bug ID: 49123
           Summary: Linking with lld causes MCJIT to fail at runtime with
                    'JIT has not been linked in'.
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: lukas.bergdoll at mvtec.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210210/d02cd786/attachment-0001.html>


More information about the llvm-bugs mailing list