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 {...@@ -1787,6 +1787,7 @@ pub const Cpu = struct {
1787 => unreachable,1787 => unreachable,
17881788
1789 .x86_64_sysv,1789 .x86_64_sysv,
1790 .x86_64_x32,
1790 .x86_64_win,1791 .x86_64_win,
1791 .x86_64_regcall_v3_sysv,1792 .x86_64_regcall_v3_sysv,
1792 .x86_64_regcall_v4_win,1793 .x86_64_regcall_v4_win,
...@@ -3632,7 +3633,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention...@@ -3632,7 +3633,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
3632 return switch (target.cpu.arch) {3633 return switch (target.cpu.arch) {
3633 .x86_64 => switch (target.os.tag) {3634 .x86_64 => switch (target.os.tag) {
3634 .windows, .uefi => .{ .x86_64_win = .{} },3635 .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 },
3636 },3640 },
3637 .x86 => switch (target.os.tag) {3641 .x86 => switch (target.os.tag) {
3638 .windows, .uefi => .{ .x86_win = .{} },3642 .windows, .uefi => .{ .x86_win = .{} },
lib/std/builtin.zig+1
...@@ -204,6 +204,7 @@ pub const CallingConvention = union(enum(u8)) {...@@ -204,6 +204,7 @@ pub const CallingConvention = union(enum(u8)) {
204204
205 // Calling conventions for the `x86_64` architecture.205 // Calling conventions for the `x86_64` architecture.
206 x86_64_sysv: CommonOptions,206 x86_64_sysv: CommonOptions,
207 x86_64_x32: CommonOptions,
207 x86_64_win: CommonOptions,208 x86_64_win: CommonOptions,
208 x86_64_regcall_v3_sysv: CommonOptions,209 x86_64_regcall_v3_sysv: CommonOptions,
209 x86_64_regcall_v4_win: CommonOptions,210 x86_64_regcall_v4_win: CommonOptions,
src/Sema.zig+1
...@@ -9035,6 +9035,7 @@ pub fn handleExternLibName(...@@ -9035,6 +9035,7 @@ pub fn handleExternLibName(
9035/// functions or there are no more other calling conventions that support variadic functions.9035/// functions or there are no more other calling conventions that support variadic functions.
9036const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{9036const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{
9037 .x86_64_sysv,9037 .x86_64_sysv,
9038 .x86_64_x32,
9038 .x86_64_win,9039 .x86_64_win,
9039 .x86_sysv,9040 .x86_sysv,
9040 .x86_win,9041 .x86_win,
src/codegen/llvm.zig+1
...@@ -11919,6 +11919,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s...@@ -11919,6 +11919,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
11919 .x86_sysv,11919 .x86_sysv,
11920 .x86_win,11920 .x86_win,
11921 .x86_thiscall_mingw,11921 .x86_thiscall_mingw,
11922 .x86_64_x32,
11922 .aarch64_aapcs,11923 .aarch64_aapcs,
11923 .aarch64_aapcs_darwin,11924 .aarch64_aapcs_darwin,
11924 .aarch64_aapcs_win,11925 .aarch64_aapcs_win,
test/cases/compile_errors/invalid_variadic_function.zig+2-2
...@@ -12,6 +12,6 @@ comptime {...@@ -12,6 +12,6 @@ comptime {
12// target=x86_64-linux12// target=x86_64-linux
13//13//
14// :1:8: error: variadic function does not support 'auto' calling convention14// :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'
16// :2:16: error: variadic function does not support 'inline' calling convention16// :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 {...@@ -15,4 +15,4 @@ comptime {
15// target=x86_64-linux15// target=x86_64-linux
16//16//
17// :1:13: error: variadic function does not support 'auto' calling convention17// :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'