aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-04 21:10:03 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-04 21:11:55 -0700
commit17fc44dd1287163c25832c40f7e81cd5532e52bd (patch)
treef8180f0b709c32a94a5f84d80d972f1085f15eaf /src/codegen/llvm.zig
parent1b432b557608bd047afaad71ffb7bd2ddf23c444 (diff)
downloadzig-17fc44dd1287163c25832c40f7e81cd5532e52bd.tar.gz
zig-17fc44dd1287163c25832c40f7e81cd5532e52bd.zip
LLVM: fix x86_64 sysv C ABI for extern structs with sub-64 bit integers
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 65289b1a8c..c0c576cdf1 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -8030,7 +8030,8 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*const llvm.
}
}
if (classes[0] == .integer and classes[1] == .none) {
- return llvm_types_buffer[0];
+ const abi_size = fn_info.return_type.abiSize(target);
+ return dg.context.intType(@intCast(c_uint, abi_size * 8));
}
return dg.context.structType(&llvm_types_buffer, llvm_types_index, .False);
},
@@ -8124,7 +8125,8 @@ fn lowerFnParamTy(dg: *DeclGen, cc: std.builtin.CallingConvention, ty: Type) !*c
}
}
if (classes[0] == .integer and classes[1] == .none) {
- return llvm_types_buffer[0];
+ const abi_size = ty.abiSize(target);
+ return dg.context.intType(@intCast(c_uint, abi_size * 8));
}
return dg.context.structType(&llvm_types_buffer, llvm_types_index, .False);
},