[llvm] Fix aot when using llvm master.
authorZoltan Varga <vargaz@gmail.com>
Wed, 6 Jul 2016 04:19:45 +0000 (00:19 -0400)
committerZoltan Varga <vargaz@gmail.com>
Wed, 6 Jul 2016 04:19:50 +0000 (00:19 -0400)
mono/mini/mini-llvm.c

index 90f9a49ba8a987d9c6a4faee414d6f6abeb61f5f..101676a973fb8af0c81208abe21c205eae2cb179 100644 (file)
@@ -6694,7 +6694,10 @@ mono_llvm_emit_method (MonoCompile *cfg)
        ctx->is_linkonce = is_linkonce;
 
 #if LLVM_API_VERSION > 100
-       ctx->lmodule = LLVMModuleCreateWithName ("jit-module");
+       if (cfg->compile_aot)
+               ctx->lmodule = ctx->module->lmodule;
+       else
+               ctx->lmodule = LLVMModuleCreateWithName ("jit-module");
 #else
        ctx->lmodule = ctx->module->lmodule;
 #endif