authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-19 22:40:15+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 09:27:17+02:00
logbeb507a1edadb2829478d066b80ea62ed537157a
treec6dabf5cecbc610b313b523bf8339ee05cec743d
parenta1441943e41014cfbce3105c4cdd9d3e0d137e4f
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.builtin: add CallingConvention.x86_64_x32

This was forgotten during the refactoring of std.builtin.CallingConvention. It mirrors mips64_n32 for MIPS.

6 files changed, 11 insertions(+), 4 deletions(-)

lib/std/Target.zig+5-1
......@@ -1787,6 +1787,7 @@ pub const Cpu = struct {
17871787 => unreachable,
17881788
17891789 .x86_64_sysv,
1790 .x86_64_x32,
17901791 .x86_64_win,
17911792 .x86_64_regcall_v3_sysv,
17921793 .x86_64_regcall_v4_win,
......@@ -3632,7 +3633,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
36323633 return switch (target.cpu.arch) {
36333634 .x86_64 => switch (target.os.tag) {
36343635 .windows, .uefi => .{ .x86_64_win = .{} },
3635 else => .{ .x86_64_sysv = .{} },
3636 else => switch (target.abi) {
3637 .gnuabin32, .muslabin32 => .{ .x86_64_x32 = .{} },
3638 else => .{ .x86_64_sysv = .{} },
3639 },
36363640 },
36373641 .x86 => switch (target.os.tag) {
36383642 .windows, .uefi => .{ .x86_win = .{} },
lib/std/builtin.zig+1
......@@ -204,6 +204,7 @@ pub const CallingConvention = union(enum(u8)) {
204204
205205 // Calling conventions for the `x86_64` architecture.
206206 x86_64_sysv: CommonOptions,
207 x86_64_x32: CommonOptions,
207208 x86_64_win: CommonOptions,
208209 x86_64_regcall_v3_sysv: CommonOptions,
209210 x86_64_regcall_v4_win: CommonOptions,
src/Sema.zig+1
......@@ -9035,6 +9035,7 @@ pub fn handleExternLibName(
90359035/// functions or there are no more other calling conventions that support variadic functions.
90369036const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{
90379037 .x86_64_sysv,
9038 .x86_64_x32,
90389039 .x86_64_win,
90399040 .x86_sysv,
90409041 .x86_win,
src/codegen/llvm.zig+1
......@@ -11919,6 +11919,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
1191911919 .x86_sysv,
1192011920 .x86_win,
1192111921 .x86_thiscall_mingw,
11922 .x86_64_x32,
1192211923 .aarch64_aapcs,
1192311924 .aarch64_aapcs_darwin,
1192411925 .aarch64_aapcs_win,
test/cases/compile_errors/invalid_variadic_function.zig+2-2
......@@ -12,6 +12,6 @@ comptime {
1212// target=x86_64-linux
1313//
1414// :1:8: error: variadic function does not support 'auto' calling convention
15// :1:8: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win'
15// :1:8: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'
1616// :2:16: error: variadic function does not support 'inline' calling convention
17// :2:16: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win'
17// :2:16: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'
test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+1-1
......@@ -15,4 +15,4 @@ comptime {
1515// target=x86_64-linux
1616//
1717// :1:13: error: variadic function does not support 'auto' calling convention
18// :1:13: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win'
18// :1:13: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'