std.builtin: add CallingConvention.x86_64_x32

This was forgotten during the refactoring of std.builtin.CallingConvention. It
mirrors mips64_n32 for MIPS.
This commit is contained in:
Alex Rønne Petersen 2025-10-19 22:40:15 +02:00
parent a1441943e4
commit beb507a1ed
No known key found for this signature in database
6 changed files with 11 additions and 4 deletions

View File

@ -1787,6 +1787,7 @@ pub const Cpu = struct {
=> unreachable, => unreachable,
.x86_64_sysv, .x86_64_sysv,
.x86_64_x32,
.x86_64_win, .x86_64_win,
.x86_64_regcall_v3_sysv, .x86_64_regcall_v3_sysv,
.x86_64_regcall_v4_win, .x86_64_regcall_v4_win,
@ -3632,7 +3633,10 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
return switch (target.cpu.arch) { return switch (target.cpu.arch) {
.x86_64 => switch (target.os.tag) { .x86_64 => switch (target.os.tag) {
.windows, .uefi => .{ .x86_64_win = .{} }, .windows, .uefi => .{ .x86_64_win = .{} },
else => .{ .x86_64_sysv = .{} }, else => switch (target.abi) {
.gnuabin32, .muslabin32 => .{ .x86_64_x32 = .{} },
else => .{ .x86_64_sysv = .{} },
},
}, },
.x86 => switch (target.os.tag) { .x86 => switch (target.os.tag) {
.windows, .uefi => .{ .x86_win = .{} }, .windows, .uefi => .{ .x86_win = .{} },

View File

@ -204,6 +204,7 @@ pub const CallingConvention = union(enum(u8)) {
// Calling conventions for the `x86_64` architecture. // Calling conventions for the `x86_64` architecture.
x86_64_sysv: CommonOptions, x86_64_sysv: CommonOptions,
x86_64_x32: CommonOptions,
x86_64_win: CommonOptions, x86_64_win: CommonOptions,
x86_64_regcall_v3_sysv: CommonOptions, x86_64_regcall_v3_sysv: CommonOptions,
x86_64_regcall_v4_win: CommonOptions, x86_64_regcall_v4_win: CommonOptions,

View File

@ -9035,6 +9035,7 @@ pub fn handleExternLibName(
/// functions or there are no more other calling conventions that support variadic functions. /// functions or there are no more other calling conventions that support variadic functions.
const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{
.x86_64_sysv, .x86_64_sysv,
.x86_64_x32,
.x86_64_win, .x86_64_win,
.x86_sysv, .x86_sysv,
.x86_win, .x86_win,

View File

@ -11919,6 +11919,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s
.x86_sysv, .x86_sysv,
.x86_win, .x86_win,
.x86_thiscall_mingw, .x86_thiscall_mingw,
.x86_64_x32,
.aarch64_aapcs, .aarch64_aapcs,
.aarch64_aapcs_darwin, .aarch64_aapcs_darwin,
.aarch64_aapcs_win, .aarch64_aapcs_win,

View File

@ -12,6 +12,6 @@ comptime {
// target=x86_64-linux // target=x86_64-linux
// //
// :1:8: error: variadic function does not support 'auto' calling convention // :1:8: error: variadic function does not support 'auto' calling convention
// :1:8: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' // :1:8: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'
// :2:16: error: variadic function does not support 'inline' calling convention // :2:16: error: variadic function does not support 'inline' calling convention
// :2:16: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' // :2:16: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'

View File

@ -15,4 +15,4 @@ comptime {
// target=x86_64-linux // target=x86_64-linux
// //
// :1:13: error: variadic function does not support 'auto' calling convention // :1:13: error: variadic function does not support 'auto' calling convention
// :1:13: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' // :1:13: note: supported calling conventions: 'x86_64_sysv', 'x86_64_x32', 'x86_64_win'