diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-12-15 11:24:44 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-12-15 14:42:53 -0500 |
| commit | f1407b4b7ebe33f00cc8222e875ce271716671ad (patch) | |
| tree | 6de02da9460658c297e0de3322dc4b0b166719cb /src/analyze.cpp | |
| parent | 19ddbd9e9e691ff7ab8789e8c6962497fbba4b88 (diff) | |
| download | zig-f1407b4b7ebe33f00cc8222e875ce271716671ad.tar.gz zig-f1407b4b7ebe33f00cc8222e875ce271716671ad.zip | |
Generate the fn pointers into the correct address space
Fixes #3645
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 35a4bd7d4a..eb32e10148 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -8779,7 +8779,8 @@ static void resolve_llvm_types_fn_type(CodeGen *g, ZigType *fn_type) { fn_type->data.fn.raw_type_ref = LLVMFunctionType(get_llvm_type(g, gen_return_type), gen_param_types.items, (unsigned int)gen_param_types.length, fn_type_id->is_var_args); - fn_type->llvm_type = LLVMPointerType(fn_type->data.fn.raw_type_ref, 0); + const unsigned fn_addrspace = ZigLLVMDataLayoutGetProgramAddressSpace(g->target_data_ref); + fn_type->llvm_type = LLVMPointerType(fn_type->data.fn.raw_type_ref, fn_addrspace); fn_type->data.fn.raw_di_type = ZigLLVMCreateSubroutineType(g->dbuilder, param_di_types.items, (int)param_di_types.length, 0); fn_type->llvm_di_type = ZigLLVMCreateDebugPointerType(g->dbuilder, fn_type->data.fn.raw_di_type, LLVMStoreSizeOfType(g->target_data_ref, fn_type->llvm_type), @@ -8888,7 +8889,8 @@ static void resolve_llvm_types_any_frame(CodeGen *g, ZigType *any_frame_type, Re ZigType *result_type = any_frame_type->data.any_frame.result_type; ZigType *ptr_result_type = (result_type == nullptr) ? nullptr : get_pointer_to_type(g, result_type, false); - LLVMTypeRef ptr_fn_llvm_type = LLVMPointerType(fn_type, 0); + const unsigned fn_addrspace = ZigLLVMDataLayoutGetProgramAddressSpace(g->target_data_ref); + LLVMTypeRef ptr_fn_llvm_type = LLVMPointerType(fn_type, fn_addrspace); if (result_type == nullptr) { g->anyframe_fn_type = ptr_fn_llvm_type; } |
