zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit eedf7d92990676922ddbf1d2928d3d2a4d2e7487 (tree)
parent dab794394ff816e892d757b4c7fe52958f14dfe9
Author: ARandomOSDever <arandomosdever@noreply.codeberg.org>
Date:   Mon,  8 Jun 2026 18:20:11 +0300

std.Target: add wiiu OS tag

Diffstat:
Mlib/std/Build/Configuration.zig | 3+++
Mlib/std/Target.zig | 22+++++++++++++++++++++-
Mlib/std/debug.zig | 2+-
Mlib/std/start.zig | 2+-
Msrc/Compilation.zig | 1+
Msrc/codegen/llvm.zig | 1+
Mtest/llvm_targets.zig | 1+
7 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/lib/std/Build/Configuration.zig b/lib/std/Build/Configuration.zig @@ -2584,6 +2584,7 @@ pub const TargetQuery = struct { windows, uefi, @"3ds", + wiiu, ps3, ps4, ps5, @@ -2632,6 +2633,7 @@ pub const TargetQuery = struct { .windows => .windows, .uefi => .uefi, .@"3ds" => .@"3ds", + .wiiu => .wiiu, .ps3 => .ps3, .ps4 => .ps4, .ps5 => .ps5, @@ -2680,6 +2682,7 @@ pub const TargetQuery = struct { .windows => .windows, .uefi => .uefi, .@"3ds" => .@"3ds", + .wiiu => .wiiu, .ps3 => .ps3, .ps4 => .ps4, .ps5 => .ps5, diff --git a/lib/std/Target.zig b/lib/std/Target.zig @@ -49,6 +49,7 @@ pub const Os = struct { uefi, @"3ds", + wiiu, ps3, ps4, @@ -196,6 +197,7 @@ pub const Os = struct { .uefi, .@"3ds", + .wiiu, .psp, .vita, @@ -622,6 +624,13 @@ pub const Os = struct { }, }, + .wiiu => .{ + .semver = .{ + .min = .{ .major = 5, .minor = 5, .patch = 5 }, // Latest global release + .max = .{ .major = 5, .minor = 5, .patch = 6 }, // Latest US only release + }, + }, + .psp => .{ .semver = .{ // https://www.psdevwiki.com/psp/Official_Firmware_(OFW)#1.XX_Kernel @@ -933,6 +942,7 @@ pub const Abi = enum { .windows => .gnu, .uefi => .msvc, .@"3ds" => .eabihf, + .wiiu => .eabihf, .psp => .eabihf, .vita => .eabihf, .wasi, .emscripten => .musl, @@ -2093,7 +2103,7 @@ pub const Cpu = struct { .msp430 => &msp430.cpu.msp430, .nvptx, .nvptx64 => &nvptx.cpu.sm_52, .powerpc => switch (os.tag) { - .openbsd => &powerpc.cpu.@"750", + .openbsd, .wiiu => &powerpc.cpu.@"750", else => generic(arch), }, .powerpc64 => switch (os.tag) { @@ -2298,6 +2308,7 @@ pub fn requiresLibC(target: *const Target) bool { .other, .@"3ds", .tios, + .wiiu, => false, }; } @@ -2444,6 +2455,7 @@ pub const DynamicLinker = struct { .windows, .@"3ds", + .wiiu, .emscripten, .wasi, @@ -2866,6 +2878,7 @@ pub const DynamicLinker = struct { .windows, .@"3ds", + .wiiu, .psp, .vita, @@ -3422,6 +3435,13 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { .longlong, .ulonglong, .double, .longdouble => return 64, }, + .wiiu => switch (c_type) { + .char => return 8, + .short, .ushort => return 16, + .int, .uint, .float, .long, .ulong => return 32, + .longlong, .ulonglong, .double, .longdouble => return 64, + }, + .ps4, .ps5 => switch (c_type) { .char => return 8, .short, .ushort => return 16, diff --git a/lib/std/debug.zig b/lib/std/debug.zig @@ -501,7 +501,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn { if (use_trap_panic) @trap(); switch (builtin.os.tag) { - .freestanding, .other, .@"3ds", .psp, .vita => { + .freestanding, .other, .@"3ds", .wiiu, .psp, .vita => { @trap(); }, .uefi => { diff --git a/lib/std/start.zig b/lib/std/start.zig @@ -70,7 +70,7 @@ comptime { // case it's not required to provide an entrypoint such as main. if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name }); } else switch (native_os) { - .other, .freestanding, .@"3ds", .psp, .vita, .vulkan, .opengl, .opencl => {}, + .other, .freestanding, .@"3ds", .wiiu, .psp, .vita, .vulkan, .opengl, .opencl => {}, else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }), } } diff --git a/src/Compilation.zig b/src/Compilation.zig @@ -6353,6 +6353,7 @@ fn addCommonCCArgs( .serenity => try argv.append("__serenity__"), // Homebrew targets without LLVM support; use communities's preferred macros. .@"3ds" => try argv.append("-D__3DS__"), + .wiiu => try argv.append("-D__WIIU__"), .psp => try argv.append("-D__PSP__"), .vita => try argv.append("-D__vita__"), else => {}, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig @@ -246,6 +246,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .psp, .tios, .vita, + .wiiu, => "unknown", }; try llvm_triple.appendSlice(llvm_os); diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig @@ -192,6 +192,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .powerpc, .os_tag = .openbsd, .abi = .eabihf }, .{ .cpu_arch = .powerpc, .os_tag = .rtems, .abi = .eabi }, .{ .cpu_arch = .powerpc, .os_tag = .rtems, .abi = .eabihf }, + .{ .cpu_arch = .powerpc, .os_tag = .wiiu, .abi = .eabihf }, .{ .cpu_arch = .powerpcle, .os_tag = .freestanding, .abi = .eabi }, .{ .cpu_arch = .powerpcle, .os_tag = .freestanding, .abi = .eabihf },