name = get_aotconst_name (type, data, got_offset);
if (llvm_type) {
- load = convert (ctx, LLVMBuildLoad (builder, got_entry_addr, ""), llvm_type);
+ load = LLVMBuildLoad (builder, got_entry_addr, "");
+ load = convert (ctx, load, llvm_type);
LLVMSetValueName (load, name ? name : "");
} else {
load = LLVMBuildLoad (builder, got_entry_addr, name ? name : "");
g_hash_table_insert (ctx->module->direct_callables, (char*)callee_name, callee);
} else {
+ /* LLVMTypeRef's are uniqued */
+ if (LLVMGetElementType (LLVMTypeOf (callee)) != llvm_sig)
+ return LLVMConstBitCast (callee, LLVMPointerType (llvm_sig, 0));
+
g_free (callee_name);
}
return callee;
if (!sig)
sig = LLVMFunctionType1 (LLVMVoidType (), LLVMInt32Type (), FALSE);
- callee = get_callee (ctx, sig, MONO_PATCH_INFO_INTERNAL_METHOD, "mono_llvm_throw_corlib_exception");
+ callee = get_callee (ctx, sig, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_llvm_throw_corlib_exception");
LLVMBuildBr (builder, ex2_bb);
LLVMTypeRef fun_sig = LLVMFunctionType1 (LLVMVoidType (), exc_type, FALSE);
if (ctx->cfg->compile_aot) {
- callee = get_callee (ctx, fun_sig, MONO_PATCH_INFO_INTERNAL_METHOD, icall_name);
+ callee = get_callee (ctx, fun_sig, MONO_PATCH_INFO_JIT_ICALL_ADDR, icall_name);
} else {
callee = LLVMAddFunction (ctx->lmodule, icall_name, fun_sig);
LLVMAddGlobalMapping (ctx->module->ee, callee, resolve_patch (ctx->cfg, MONO_PATCH_INFO_INTERNAL_METHOD, icall_name));
values [ins->dreg] = LLVMBuildLoad (builder, got_entry_addr, name);
g_free (name);
/* Can't use this in llvmonly mode since the got slots are initialized by the methods themselves */
- if (!mono_llvm_only)
+ if (!cfg->llvm_only)
set_invariant_load_flag (values [ins->dreg]);
break;
}
register_icall (mono_llvm_match_exception, "mono_llvm_match_exception", "int ptr int int", TRUE);
register_icall (mono_llvm_clear_exception, "mono_llvm_clear_exception", NULL, TRUE);
register_icall (mono_llvm_load_exception, "mono_llvm_load_exception", "object", TRUE);
- register_icall (mono_llvm_throw_corlib_exception, "mono_llvm_throw_corlib_exception", "void int", FALSE);
+ register_icall (mono_llvm_throw_corlib_exception, "mono_llvm_throw_corlib_exception", "void int", TRUE);
#if defined(ENABLE_LLVM) && !defined(MONO_LLVM_LOADED)
register_icall (mono_llvm_set_unhandled_exception_handler, "mono_llvm_set_unhandled_exception_handler", NULL, TRUE);