diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-05-04 21:10:03 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-05-04 21:11:55 -0700 |
| commit | 17fc44dd1287163c25832c40f7e81cd5532e52bd (patch) | |
| tree | f8180f0b709c32a94a5f84d80d972f1085f15eaf /src/codegen | |
| parent | 1b432b557608bd047afaad71ffb7bd2ddf23c444 (diff) | |
| download | zig-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')
| -rw-r--r-- | src/codegen/llvm.zig | 6 |
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); }, |
