std.Target: add vita os

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
This commit is contained in:
Maciej 'vesim' Kuliński 2025-07-21 13:02:27 +02:00 committed by Alex Rønne Petersen
parent 99b2b61516
commit ff859088e4
4 changed files with 37 additions and 2 deletions

View file

@ -55,6 +55,7 @@ pub const Os = struct {
ps3,
ps4,
ps5,
vita,
emscripten,
wasi,
@ -198,6 +199,8 @@ pub const Os = struct {
.@"3ds",
.vita,
.wasi,
.amdhsa,
@ -607,6 +610,7 @@ pub const Os = struct {
.max = .{ .major = 2, .minor = 11, .patch = 0 },
},
},
.@"3ds" => .{
.semver = .{
// These signify release versions (https://www.3dbrew.org/wiki/NCCH/Extended_Header#ARM11_Kernel_Capabilities)
@ -618,6 +622,15 @@ pub const Os = struct {
.max = .{ .major = 2, .minor = 58, .patch = 0 }, // 11.17.0-50
},
},
.vita => .{
.semver = .{
// 1.3 is the first public release
.min = .{ .major = 1, .minor = 3, .patch = 0 },
.max = .{ .major = 3, .minor = 60, .patch = 0 },
},
},
.wasi => .{
.semver = .{
.min = .{ .major = 0, .minor = 1, .patch = 0 },
@ -876,6 +889,7 @@ pub const Abi = enum {
.windows => .gnu,
.uefi => .msvc,
.@"3ds" => .eabihf,
.vita => .eabihf,
.wasi, .emscripten => .musl,
.contiki,
@ -1863,9 +1877,14 @@ pub const Cpu = struct {
.amdgcn => &amdgcn.cpu.gfx906,
.arm => switch (os.tag) {
.@"3ds" => &arm.cpu.mpcore,
.vita => &arm.cpu.cortex_a9,
else => &arm.cpu.baseline,
},
.armeb, .thumb, .thumbeb => &arm.cpu.baseline,
.thumb => switch (os.tag) {
.vita => &arm.cpu.cortex_a9,
else => &arm.cpu.baseline,
},
.armeb, .thumbeb => &arm.cpu.baseline,
.aarch64 => switch (os.tag) {
.driverkit, .macos => &aarch64.cpu.apple_m1,
.ios, .tvos => &aarch64.cpu.apple_a7,
@ -2079,6 +2098,7 @@ pub fn requiresLibC(target: *const Target) bool {
.amdhsa,
.ps4,
.ps5,
.vita,
.mesa3d,
.contiki,
.amdpal,
@ -2208,6 +2228,7 @@ pub const DynamicLinker = struct {
.ps3,
.ps4,
.ps5,
.vita,
=> .none,
};
}
@ -2579,6 +2600,8 @@ pub const DynamicLinker = struct {
.@"3ds",
.vita,
.emscripten,
.wasi,
@ -3111,6 +3134,13 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
.longlong, .ulonglong, .double => return 64,
.longdouble => return 80,
},
.vita => switch (c_type) {
.char => return 8,
.short, .ushort => return 16,
.int, .uint, .float => return 32,
.long, .ulong => return 64,
.longlong, .ulonglong, .double, .longdouble => return 64,
},
.ps3,
.contiki,

View file

@ -6927,8 +6927,10 @@ pub fn addCCArgs(
},
}
// Homebrew targets without LLVM support; use communities's preferred macros.
switch (target.os.tag) {
.@"3ds" => try argv.append("-D__3DS__"),
.vita => try argv.append("-D__vita__"),
else => {},
}

View file

@ -200,7 +200,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
.freebsd => "freebsd",
.fuchsia => "fuchsia",
.linux => "linux",
.ps3 => "lv2",
.netbsd => "netbsd",
.openbsd => "openbsd",
.solaris, .illumos => "solaris",
@ -213,8 +212,10 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
.nvcl => "nvcl",
.amdhsa => "amdhsa",
.opencl => "unknown", // https://llvm.org/docs/SPIRVUsage.html#target-triples
.ps3 => "lv2",
.ps4 => "ps4",
.ps5 => "ps5",
.vita => "unknown", // LLVM doesn't know about this target
.mesa3d => "mesa3d",
.amdpal => "amdpal",
.hermit => "hermit",

View file

@ -70,6 +70,7 @@ const targets = [_]std.Target.Query{
.{ .cpu_arch = .arm, .os_tag = .rtems, .abi = .eabihf },
// .{ .cpu_arch = .arm, .os_tag = .uefi, .abi = .eabi },
// .{ .cpu_arch = .arm, .os_tag = .uefi, .abi = .eabihf },
.{ .cpu_arch = .arm, .os_tag = .vita, .abi = .eabihf },
.{ .cpu_arch = .armeb, .os_tag = .freestanding, .abi = .eabi },
.{ .cpu_arch = .armeb, .os_tag = .freestanding, .abi = .eabihf },
@ -263,6 +264,7 @@ const targets = [_]std.Target.Query{
.{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .musleabihf },
.{ .cpu_arch = .thumb, .os_tag = .rtems, .abi = .eabi },
.{ .cpu_arch = .thumb, .os_tag = .rtems, .abi = .eabihf },
.{ .cpu_arch = .thumb, .os_tag = .vita, .abi = .eabihf },
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .gnu },
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .itanium },
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .msvc },