summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_bitcode_link.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/llvm/llvm_bitcode_link.cpp')
-rw-r--r--backend/src/llvm/llvm_bitcode_link.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/backend/src/llvm/llvm_bitcode_link.cpp b/backend/src/llvm/llvm_bitcode_link.cpp
index 5c6585d0..ef56e4c2 100644
--- a/backend/src/llvm/llvm_bitcode_link.cpp
+++ b/backend/src/llvm/llvm_bitcode_link.cpp
@@ -340,7 +340,8 @@ namespace gbe
/* We use beignet's bitcode as dst because it will have a lot of
lazy functions which will not be loaded. */
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
- if(LLVMLinkModules2(wrap(clonedLib), wrap(mod))) {
+ llvm::Module * linked_module = llvm::CloneModule((llvm::Module*)mod).release();
+ if(LLVMLinkModules2(wrap(clonedLib), wrap(linked_module))) {
#else
char* errorMsg;
if(LLVMLinkModules(wrap(clonedLib), wrap(mod), LLVMLinkerDestroySource, &errorMsg)) {