Skip to content

Commit 18f8d35

Browse files
committed
rustllvm: fix wrapper builds with LLVM 3.5
EngineBuilder signature has changed in LLVM 3.6, as the interface was not move-based in previous releases. Signed-off-by: Luca Bruno <[email protected]>
1 parent 88f8f52 commit 18f8d35

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rustllvm/ExecutionEngineWrapper.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine(
8282
InitializeNativeTargetAsmPrinter();
8383
InitializeNativeTargetAsmParser();
8484

85-
std::unique_ptr<Module> m(unwrap(mod));
8685
RustJITMemoryManager *mm = unwrap(mref);
8786

8887
std::string error_str;
@@ -91,12 +90,22 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine(
9190
options.JITEmitDebugInfo = true;
9291
options.NoFramePointerElim = true;
9392

93+
#if LLVM_VERSION_MINOR > 5
94+
std::unique_ptr<Module> m(unwrap(mod));
9495
ExecutionEngine *ee = EngineBuilder(std::move(m))
9596
.setEngineKind(EngineKind::JIT)
9697
.setErrorStr(&error_str)
9798
.setMCJITMemoryManager(mm)
9899
.setTargetOptions(options)
99100
.create();
101+
#else
102+
ExecutionEngine *ee = EngineBuilder(unwrap(mod))
103+
.setEngineKind(EngineKind::JIT)
104+
.setErrorStr(&error_str)
105+
.setMCJITMemoryManager(mm)
106+
.setTargetOptions(options)
107+
.create();
108+
#endif
100109

101110
if (!ee)
102111
LLVMRustSetLastError(error_str.c_str());

0 commit comments

Comments
 (0)