authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-06-18 02:37:52+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-06-18 02:37:52+02:00
log6aaea5af415a821ee134b23cc468d32695c3063d
tree1e7ace5b8fa039ed75397c5206bd2cbc13cd44af
parent18d5cd67ce3759cbc1997279ee3b03dd2bb9aa72
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: add abin32 and x32 Abi tags

We only had gnu/musl variants of these previously.

13 files changed, 119 insertions(+), 92 deletions(-)

lib/std/Build/Configuration.zig+6
......@@ -2271,6 +2271,8 @@ pub const TargetQuery = struct {
22712271 gnux32,
22722272 eabi,
22732273 eabihf,
2274 abin32,
2275 x32,
22742276 ilp32,
22752277 android,
22762278 androideabi,
......@@ -2304,6 +2306,8 @@ pub const TargetQuery = struct {
23042306 .gnux32 => .gnux32,
23052307 .eabi => .eabi,
23062308 .eabihf => .eabihf,
2309 .abin32 => .abin32,
2310 .x32 => .x32,
23072311 .ilp32 => .ilp32,
23082312 .android => .android,
23092313 .androideabi => .androideabi,
......@@ -2337,6 +2341,8 @@ pub const TargetQuery = struct {
23372341 .gnux32 => .gnux32,
23382342 .eabi => .eabi,
23392343 .eabihf => .eabihf,
2344 .abin32 => .abin32,
2345 .x32 => .x32,
23402346 .ilp32 => .ilp32,
23412347 .android => .android,
23422348 .androideabi => .androideabi,
lib/std/Target.zig+76-67
......@@ -796,6 +796,8 @@ pub const Abi = enum {
796796 gnux32,
797797 eabi,
798798 eabihf,
799 abin32,
800 x32,
799801 ilp32,
800802 android,
801803 androideabi,
......@@ -2924,10 +2926,17 @@ pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {
29242926
29252927pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
29262928 switch (abi) {
2927 .gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32,
2928 .gnuabi64, .muslabi64 => return 64,
2929 .gnux32,
2930 .muslx32,
2931 .x32,
2932 .gnuabin32,
2933 .muslabin32,
2934 .abin32,
2935 .ilp32,
2936 => return 32,
29292937 else => {},
29302938 }
2939
29312940 return switch (cpu_arch) {
29322941 .avr,
29332942 .msp430,
......@@ -3006,12 +3015,12 @@ pub fn ptrBitWidth(target: *const Target) u16 {
30063015pub fn stackAlignment(target: *const Target) u16 {
30073016 // Overrides for when the stack alignment is not equal to the pointer width.
30083017 switch (target.cpu.arch) {
3009 .ez80,
3010 => return 1,
3011 .m68k,
3012 => return 2,
3013 .amdgcn,
3014 => return 4,
3018 .ez80 => return 1,
3019
3020 .m68k => return 2,
3021
3022 .amdgcn => return 4,
3023
30153024 .arm,
30163025 .armeb,
30173026 .hppa,
......@@ -3022,6 +3031,7 @@ pub fn stackAlignment(target: *const Target) u16 {
30223031 .thumb,
30233032 .thumbeb,
30243033 => return 8,
3034
30253035 .aarch64,
30263036 .aarch64_be,
30273037 .alpha,
......@@ -3038,18 +3048,23 @@ pub fn stackAlignment(target: *const Target) u16 {
30383048 .wasm64,
30393049 .x86_64,
30403050 => return 16,
3051
30413052 // Some of the following prongs should really be testing the ABI, but our current `Abi` enum
30423053 // can't handle that level of nuance yet.
30433054 .powerpc64,
30443055 .powerpc64le,
30453056 => if (target.os.tag == .linux) return 16,
3057
30463058 .riscv32,
30473059 .riscv32be,
30483060 .riscv64,
30493061 .riscv64be,
30503062 => if (!target.cpu.has(.riscv, .e)) return 16,
3063
30513064 .x86 => if (target.os.tag != .windows and target.os.tag != .uefi) return 16,
3065
30523066 .kvx => return 32,
3067
30533068 else => {},
30543069 }
30553070
......@@ -3152,7 +3167,9 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {
31523167pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
31533168 switch (target.os.tag) {
31543169 .freestanding, .other => switch (target.cpu.arch) {
3155 .msp430, .x86_16 => switch (c_type) {
3170 .msp430,
3171 .x86_16,
3172 => switch (c_type) {
31563173 .char => return 8,
31573174 .short, .ushort, .int, .uint => return 16,
31583175 .float, .long, .ulong => return 32,
......@@ -3164,12 +3181,14 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
31643181 .long, .ulong, .float, .double, .longdouble => return 32,
31653182 .longlong, .ulonglong => return 64,
31663183 },
3167 .mips64, .mips64el => switch (c_type) {
3184 .mips64,
3185 .mips64el,
3186 => switch (c_type) {
31683187 .char => return 8,
31693188 .short, .ushort => return 16,
31703189 .int, .uint, .float => return 32,
31713190 .long, .ulong => switch (target.abi) {
3172 .gnuabin32, .muslabin32 => return 32,
3191 .abin32 => return 32,
31733192 else => return 64,
31743193 },
31753194 .longlong, .ulonglong, .double => return 64,
......@@ -3180,7 +3199,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
31803199 .short, .ushort => return 16,
31813200 .int, .uint, .float => return 32,
31823201 .long, .ulong => switch (target.abi) {
3183 .gnux32, .muslx32 => return 32,
3202 .x32 => return 32,
31843203 else => return 64,
31853204 },
31863205 .longlong, .ulonglong, .double => return 64,
......@@ -3193,25 +3212,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
31933212 .long, .ulong => return target.ptrBitWidth(),
31943213 .longlong, .ulonglong, .double => return 64,
31953214 .longdouble => switch (target.cpu.arch) {
3196 .x86 => switch (target.abi) {
3197 .android => return 64,
3198 else => return 80,
3199 },
3200
3201 .powerpc,
3202 .powerpcle,
3203 .powerpc64,
3204 .powerpc64le,
3205 => switch (target.abi) {
3206 .musl,
3207 .muslabin32,
3208 .muslabi64,
3209 .musleabi,
3210 .musleabihf,
3211 .muslx32,
3212 => return 64,
3213 else => return 128,
3214 },
3215 .x86 => return 80,
32153216
32163217 .alpha,
32173218 .riscv32,
......@@ -3220,6 +3221,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
32203221 .riscv64be,
32213222 .aarch64,
32223223 .aarch64_be,
3224 .powerpc,
3225 .powerpcle,
3226 .powerpc64,
3227 .powerpc64le,
32233228 .s390x,
32243229 .sparc64,
32253230 .wasm32,
......@@ -3253,23 +3258,25 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
32533258 .wasi,
32543259 .emscripten,
32553260 => switch (target.cpu.arch) {
3256 .mips64, .mips64el => switch (c_type) {
3261 .mips64,
3262 .mips64el,
3263 => switch (c_type) {
32573264 .char => return 8,
32583265 .short, .ushort => return 16,
32593266 .int, .uint, .float => return 32,
32603267 .long, .ulong => switch (target.abi) {
3261 .gnuabin32, .muslabin32 => return 32,
3268 .gnuabin32, .muslabin32, .abin32 => return 32,
32623269 else => return 64,
32633270 },
32643271 .longlong, .ulonglong, .double => return 64,
3265 .longdouble => if (target.os.tag == .freebsd) return 64 else return 128,
3272 .longdouble => return 128,
32663273 },
32673274 .x86_64 => switch (c_type) {
32683275 .char => return 8,
32693276 .short, .ushort => return 16,
32703277 .int, .uint, .float => return 32,
32713278 .long, .ulong => switch (target.abi) {
3272 .gnux32, .muslx32 => return 32,
3279 .gnux32, .muslx32, .x32 => return 32,
32733280 else => return 64,
32743281 },
32753282 .longlong, .ulonglong, .double => return 64,
......@@ -3290,15 +3297,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
32903297 .powerpc,
32913298 .powerpcle,
32923299 => switch (target.abi) {
3293 .musl,
3294 .muslabin32,
3295 .muslabi64,
3296 .musleabi,
3297 .musleabihf,
3298 .muslx32,
3299 => return 64,
3300 .musleabi, .musleabihf => return 64,
33003301 else => switch (target.os.tag) {
3301 .freebsd, .netbsd, .openbsd => return 64,
3302 .netbsd,
3303 .openbsd,
3304 => return 64,
33023305 else => return 128,
33033306 },
33043307 },
......@@ -3306,15 +3309,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
33063309 .powerpc64,
33073310 .powerpc64le,
33083311 => switch (target.abi) {
3309 .musl,
3310 .muslabin32,
3311 .muslabi64,
3312 .musleabi,
3313 .musleabihf,
3314 .muslx32,
3315 => return 64,
3312 .musl => return 64,
33163313 else => switch (target.os.tag) {
3317 .freebsd, .openbsd => return 64,
3314 .freebsd,
3315 .openbsd,
3316 => return 64,
33183317 else => return 128,
33193318 },
33203319 },
......@@ -3350,7 +3349,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
33503349 .long, .ulong => return 32,
33513350 .longlong, .ulonglong, .double => return 64,
33523351 .longdouble => switch (target.abi) {
3353 .gnu, .ilp32 => return 80,
3352 .gnu => return 80,
33543353 else => return 64,
33553354 },
33563355 },
......@@ -3361,7 +3360,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
33613360 .long, .ulong => return 32,
33623361 .longlong, .ulonglong, .double => return 64,
33633362 .longdouble => switch (target.abi) {
3364 .gnu, .ilp32 => return 80,
3363 .gnu => return 80,
33653364 else => return 64,
33663365 },
33673366 },
......@@ -3480,12 +3479,14 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
34803479pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
34813480 // Overrides for unusual alignments
34823481 switch (target.cpu.arch) {
3483 .avr, .ez80 => return 1,
3482 .avr,
3483 .ez80,
3484 => return 1,
34843485 .x86 => switch (target.os.tag) {
34853486 .windows, .uefi => switch (c_type) {
34863487 .longlong, .ulonglong, .double => return 8,
34873488 .longdouble => switch (target.abi) {
3488 .gnu, .ilp32 => return 4,
3489 .gnu => return 4,
34893490 else => return 8,
34903491 },
34913492 else => {},
......@@ -3510,8 +3511,6 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
35103511 return @min(
35113512 std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
35123513 @as(u16, switch (target.cpu.arch) {
3513 .ez80 => 1,
3514
35153514 .msp430,
35163515 .x86_16,
35173516 => 2,
......@@ -3579,6 +3578,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
35793578 => 16,
35803579
35813580 .avr,
3581 .ez80,
35823582 => unreachable, // Handled above.
35833583 }),
35843584 );
......@@ -3591,11 +3591,13 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
35913591 .longdouble => return 4,
35923592 else => {},
35933593 },
3594 .avr, .ez80 => return 1,
3594 .avr,
3595 .ez80,
3596 => return 1,
35953597 .x86 => switch (target.os.tag) {
35963598 .windows, .uefi => switch (c_type) {
35973599 .longdouble => switch (target.abi) {
3598 .gnu, .ilp32 => return 4,
3600 .gnu => return 4,
35993601 else => return 8,
36003602 },
36013603 else => {},
......@@ -3623,9 +3625,9 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
36233625 return @min(
36243626 std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
36253627 @as(u16, switch (target.cpu.arch) {
3626 .ez80 => 1,
3627
3628 .x86_16, .msp430 => 2,
3628 .x86_16,
3629 .msp430,
3630 => 2,
36293631
36303632 .arc,
36313633 .arceb,
......@@ -3690,6 +3692,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
36903692 => 16,
36913693
36923694 .avr,
3695 .ez80,
36933696 => unreachable, // Handled above.
36943697 }),
36953698 );
......@@ -3701,7 +3704,9 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
37013704 .ez80,
37023705 => 1,
37033706
3704 .msp430, .x86_16 => 2,
3707 .msp430,
3708 .x86_16,
3709 => 2,
37053710
37063711 .arc,
37073712 .arceb,
......@@ -3770,14 +3775,18 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
37703775pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention {
37713776 return switch (target.cpu.arch) {
37723777 .x86_64 => switch (target.os.tag) {
3773 .windows, .uefi => .{ .x86_64_win = .{} },
3778 .windows,
3779 .uefi,
3780 => .{ .x86_64_win = .{} },
37743781 else => switch (target.abi) {
3775 .gnux32, .muslx32 => .{ .x86_64_x32 = .{} },
3782 .gnux32, .muslx32, .x32 => .{ .x86_64_x32 = .{} },
37763783 else => .{ .x86_64_sysv = .{} },
37773784 },
37783785 },
37793786 .x86 => switch (target.os.tag) {
3780 .windows, .uefi => .{ .x86_win = .{} },
3787 .windows,
3788 .uefi,
3789 => .{ .x86_win = .{} },
37813790 else => .{ .x86_sysv = .{} },
37823791 },
37833792 .x86_16 => .{ .x86_16_cdecl = .{} },
......@@ -3793,7 +3802,7 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
37933802 .hard => .{ .arm_aapcs_vfp = .{} },
37943803 },
37953804 .mips64, .mips64el => switch (target.abi) {
3796 .gnuabin32, .muslabin32 => .{ .mips64_n32 = .{} },
3805 .gnuabin32, .muslabin32, .abin32 => .{ .mips64_n32 = .{} },
37973806 else => .{ .mips64_n64 = .{} },
37983807 },
37993808 .mips, .mipsel => .{ .mips_o32 = .{} },
lib/std/Thread.zig+2-2
......@@ -1171,7 +1171,7 @@ const LinuxThreadImpl = struct {
11711171 [len] "{ecx}" (self.mapped.len),
11721172 ),
11731173 .x86_64 => asm volatile (switch (target.abi) {
1174 .gnux32, .muslx32 =>
1174 .gnux32, .muslx32, .x32 =>
11751175 \\ movl $0x4000000b, %%eax # SYS_munmap
11761176 \\ syscall
11771177 \\ movl $0x4000003c, %%eax # SYS_exit
......@@ -1286,7 +1286,7 @@ const LinuxThreadImpl = struct {
12861286 [len] "{$5}" (self.mapped.len),
12871287 ),
12881288 .mips64, .mips64el => asm volatile (switch (target.abi) {
1289 .gnuabin32, .muslabin32 =>
1289 .gnuabin32, .muslabin32, .abin32 =>
12901290 \\ li $v0, 6011 # SYS_munmap
12911291 \\ syscall
12921292 \\ li $v0, 6058 # SYS_exit
lib/std/os/linux.zig+10-8
......@@ -43,7 +43,7 @@ const arch_bits = switch (native_arch) {
4343 .microblaze, .microblazeel => @import("linux/microblaze.zig"),
4444 .mips, .mipsel => @import("linux/mips.zig"),
4545 .mips64, .mips64el => switch (builtin.abi) {
46 .gnuabin32, .muslabin32 => @import("linux/mipsn32.zig"),
46 .gnuabin32, .muslabin32, .abin32 => @import("linux/mipsn32.zig"),
4747 else => @import("linux/mips64.zig"),
4848 },
4949 .or1k => @import("linux/or1k.zig"),
......@@ -57,7 +57,7 @@ const arch_bits = switch (native_arch) {
5757 .sparc64 => @import("linux/sparc64.zig"),
5858 .x86 => @import("linux/x86.zig"),
5959 .x86_64 => switch (builtin.abi) {
60 .gnux32, .muslx32 => @import("linux/x32.zig"),
60 .gnux32, .muslx32, .x32 => @import("linux/x32.zig"),
6161 else => @import("linux/x86_64.zig"),
6262 },
6363 .xtensa, .xtensaeb => @import("linux/xtensa.zig"),
......@@ -144,7 +144,7 @@ pub const SYS = switch (native_arch) {
144144 .microblaze, .microblazeel => syscalls.Microblaze,
145145 .mips, .mipsel => syscalls.MipsO32,
146146 .mips64, .mips64el => switch (builtin.abi) {
147 .gnuabin32, .muslabin32 => syscalls.MipsN32,
147 .gnuabin32, .muslabin32, .abin32 => syscalls.MipsN32,
148148 else => syscalls.MipsN64,
149149 },
150150 .or1k => syscalls.OpenRisc,
......@@ -158,7 +158,7 @@ pub const SYS = switch (native_arch) {
158158 .sparc64 => syscalls.Sparc64,
159159 .x86 => syscalls.X86,
160160 .x86_64 => switch (builtin.abi) {
161 .gnux32, .muslx32 => syscalls.X32,
161 .gnux32, .muslx32, .x32 => syscalls.X32,
162162 else => syscalls.X64,
163163 },
164164 .xtensa, .xtensaeb => syscalls.Xtensa,
......@@ -1828,8 +1828,10 @@ pub fn lseek(fd: fd_t, offset: off_t, whence: u32) u64 {
18281828 return switch (builtin.abi) {
18291829 .gnuabin32,
18301830 .muslabin32,
1831 .abin32,
18311832 .gnux32,
18321833 .muslx32,
1834 .x32,
18331835 => syscall_lseek(fd, offset, whence),
18341836 else => syscall3(.lseek, @as(u32, @bitCast(fd)), @as(u64, @bitCast(offset)), whence),
18351837 };
......@@ -2006,7 +2008,7 @@ pub const F = struct {
20062008 const SETLKW = 35;
20072009 },
20082010 .mips64, .mips64el => switch (native_abi) {
2009 .gnuabin32, .muslabin32 => struct {
2011 .gnuabin32, .muslabin32, .abin32 => struct {
20102012 const GETLK = 33;
20112013 const SETLK = 34;
20122014 const SETLKW = 35;
......@@ -3187,7 +3189,7 @@ pub fn tee(src: fd_t, dest: fd_t, len: usize, flags: u32) usize {
31873189}
31883190
31893191pub const Sysinfo = switch (native_abi) {
3190 .gnux32, .muslx32 => extern struct {
3192 .gnux32, .muslx32, .x32 => extern struct {
31913193 /// Seconds since boot
31923194 uptime: i64,
31933195 /// 1, 5, and 15 minute load averages
......@@ -10753,11 +10755,11 @@ pub const AUDIT = struct {
1075310755 .mips => .MIPS,
1075410756 .mipsel => .MIPSEL,
1075510757 .mips64 => switch (native_abi) {
10756 .gnuabin32, .muslabin32 => .MIPS64N32,
10758 .gnuabin32, .muslabin32, .abin32 => .MIPS64N32,
1075710759 else => .MIPS64,
1075810760 },
1075910761 .mips64el => switch (native_abi) {
10760 .gnuabin32, .muslabin32 => .MIPSEL64N32,
10762 .gnuabin32, .muslabin32, .abin32 => .MIPSEL64N32,
1076110763 else => .MIPSEL64,
1076210764 },
1076310765 .or1k => .OPENRISC,
lib/std/pie.zig+1-1
......@@ -162,7 +162,7 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
162162 :
163163 : .{ .lr = true }),
164164 .mips64, .mips64el => switch (builtin.abi) {
165 .gnuabin32, .muslabin32 => asm volatile (
165 .gnuabin32, .muslabin32, .abin32 => asm volatile (
166166 \\ .weak _DYNAMIC
167167 \\ .hidden _DYNAMIC
168168 \\ bal 1f
lib/std/start.zig+1-1
......@@ -373,7 +373,7 @@ fn _start() callconv(.naked) noreturn {
373373 \\ jalr $t9
374374 ,
375375 .mips64, .mips64el => switch (builtin.abi) {
376 .gnuabin32, .muslabin32 =>
376 .gnuabin32, .muslabin32, .abin32 =>
377377 \\ move $fp, $zero
378378 \\ bal 1f
379379 \\ .gpword .
lib/std/zig/LibCDirs.zig+2
......@@ -282,6 +282,8 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 {
282282 => return "musl",
283283 .eabi,
284284 .eabihf,
285 .abin32,
286 .x32,
285287 .ilp32,
286288 .android,
287289 .androideabi,
lib/std/zig/system.zig+2-2
......@@ -104,7 +104,7 @@ pub fn getExternalExecutor(io: Io, candidate: *const std.Target, options: GetExt
104104 => .{ .qemu = switch (t) {
105105 .x86 => "qemu-i386",
106106 .x86_64 => switch (candidate.abi) {
107 .gnux32, .muslx32 => return bad_result,
107 .gnux32, .muslx32, .x32 => return bad_result,
108108 else => "qemu-x86_64",
109109 },
110110 else => "qemu-" ++ @tagName(t),
......@@ -146,7 +146,7 @@ pub fn getExternalExecutor(io: Io, candidate: *const std.Target, options: GetExt
146146 .powerpc64 => "qemu-ppc64",
147147 .powerpc64le => "qemu-ppc64le",
148148 .mips64, .mips64el => switch (candidate.abi) {
149 .gnuabin32, .muslabin32 => if (t == .mips64el) "qemu-mipsn32el" else "qemu-mipsn32",
149 .gnuabin32, .muslabin32, .abin32 => if (t == .mips64el) "qemu-mipsn32el" else "qemu-mipsn32",
150150 else => "qemu-" ++ @tagName(t),
151151 },
152152 // TODO: Actually check the SuperH version.
src/codegen/llvm.zig+5-3
......@@ -285,6 +285,8 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
285285 .ilp32 => "unknown",
286286 .eabi => "eabi",
287287 .eabihf => "eabihf",
288 .abin32 => "unknown",
289 .x32 => "muslx32", // https://github.com/ziglang/zig/issues/25649
288290 .android => "android",
289291 .androideabi => "androideabi",
290292 .musl => switch (target.os.tag) {
......@@ -377,11 +379,11 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
377379 .mips => "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64",
378380 .mipsel => "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64",
379381 .mips64 => switch (target.abi) {
380 .gnuabin32, .muslabin32 => "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
382 .gnuabin32, .muslabin32, .abin32 => "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
381383 else => "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
382384 },
383385 .mips64el => switch (target.abi) {
384 .gnuabin32, .muslabin32 => "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
386 .gnuabin32, .muslabin32, .abin32 => "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
385387 else => "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
386388 },
387389 .m68k => "E-m:e-p:32:16:32-i8:8:8-i16:16:16-i32:16:32-n8:16:32-a:0:16-S16",
......@@ -446,7 +448,7 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
446448 .x86_64 => if (target.os.tag.isDarwin() or target.ofmt == .macho)
447449 "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
448450 else switch (target.abi) {
449 .gnux32, .muslx32 => "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
451 .gnux32, .muslx32, .x32 => "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
450452 else => if ((target.os.tag == .windows or target.os.tag == .uefi) and target.ofmt == .coff)
451453 "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
452454 else
src/link/Lld.zig+5-5
......@@ -1295,21 +1295,21 @@ fn getLDMOption(target: *const std.Target) ?[]const u8 {
12951295 },
12961296 .mips64 => switch (target.os.tag) {
12971297 .freebsd => switch (target.abi) {
1298 .gnuabin32, .muslabin32 => "elf32btsmipn32_fbsd",
1298 .gnuabin32, .muslabin32, .abin32 => "elf32btsmipn32_fbsd",
12991299 else => "elf64btsmip_fbsd",
13001300 },
13011301 else => switch (target.abi) {
1302 .gnuabin32, .muslabin32 => "elf32btsmipn32",
1302 .gnuabin32, .muslabin32, .abin32 => "elf32btsmipn32",
13031303 else => "elf64btsmip",
13041304 },
13051305 },
13061306 .mips64el => switch (target.os.tag) {
13071307 .freebsd => switch (target.abi) {
1308 .gnuabin32, .muslabin32 => "elf32ltsmipn32_fbsd",
1308 .gnuabin32, .muslabin32, .abin32 => "elf32ltsmipn32_fbsd",
13091309 else => "elf64ltsmip_fbsd",
13101310 },
13111311 else => switch (target.abi) {
1312 .gnuabin32, .muslabin32 => "elf32ltsmipn32",
1312 .gnuabin32, .muslabin32, .abin32 => "elf32ltsmipn32",
13131313 else => "elf64ltsmip",
13141314 },
13151315 },
......@@ -1336,7 +1336,7 @@ fn getLDMOption(target: *const std.Target) ?[]const u8 {
13361336 else => "elf_i386",
13371337 },
13381338 .x86_64 => switch (target.abi) {
1339 .gnux32, .muslx32 => "elf32_x86_64",
1339 .gnux32, .muslx32, .x32 => "elf32_x86_64",
13401340 else => "elf_x86_64",
13411341 },
13421342 else => null,
src/target.zig+5-2
......@@ -164,7 +164,10 @@ pub fn hasValgrindSupport(target: *const std.Target, backend: std.lang.CompilerB
164164 else => false,
165165 },
166166 .x86_64 => switch (target.os.tag) {
167 .linux => target.abi != .gnux32 and target.abi != .muslx32,
167 .linux => switch (target.abi) {
168 .gnux32, .muslx32, .x32 => false,
169 else => true,
170 },
168171 .freebsd, .illumos => true,
169172 .windows => !ofmt_c_msvc,
170173 else => false,
......@@ -700,7 +703,7 @@ pub fn llvmMachineAbi(target: *const std.Target) ?[:0]const u8 {
700703 },
701704 .mips, .mipsel => "o32",
702705 .mips64, .mips64el => switch (target.abi) {
703 .gnuabin32, .muslabin32 => "n32",
706 .gnuabin32, .muslabin32, .abin32 => "n32",
704707 else => "n64",
705708 },
706709 .powerpc64 => if (target.os.tag == .ps3) "elfv1" else "elfv2",
test/behavior/basic.zig+1-1
......@@ -1145,7 +1145,7 @@ test "arrays and vectors with big integers" {
11451145 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
11461146 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
11471147 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
1148 if (builtin.zig_backend == .stage2_llvm and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23805
1148 if (builtin.zig_backend == .stage2_llvm and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32 or builtin.abi == .abin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23805
11491149
11501150 inline for (.{ u65528, u65529, u65535 }) |Int| {
11511151 var a: [1]Int = undefined;
test/llvm_targets.zig+3
......@@ -159,6 +159,7 @@ const targets = [_]std.Target.Query{
159159 .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabihf },
160160
161161 .{ .cpu_arch = .mips64, .os_tag = .freestanding, .abi = .none },
162 .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .abin32 },
162163 .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .gnuabi64 },
163164 .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .gnuabin32 },
164165 .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .muslabi64 },
......@@ -167,6 +168,7 @@ const targets = [_]std.Target.Query{
167168 .{ .cpu_arch = .mips64, .os_tag = .openbsd, .abi = .none },
168169
169170 .{ .cpu_arch = .mips64el, .os_tag = .freestanding, .abi = .none },
171 .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .abin32 },
170172 .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .gnuabi64 },
171173 .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .gnuabin32 },
172174 .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .muslabi64 },
......@@ -331,6 +333,7 @@ const targets = [_]std.Target.Query{
331333 .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .muslx32 },
332334 .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none },
333335 .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .ohos },
336 .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .x32 },
334337 .{ .cpu_arch = .x86_64, .os_tag = .maccatalyst, .abi = .none },
335338 .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none },
336339 .{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none },