authorgravatar for iridescentrosesfall@gmail.comNathan Bourgeois <iridescentrosesfall@gmail.com> 2026-03-21 01:47:21-04:00
committergravatar for iridescentrosesfall@gmail.comNathan Bourgeois <iridescentrosesfall@gmail.com> 2026-03-21 02:56:24-04:00
logfdf19984b8af9781cd68dda3fcbcc44ac8ade80e
treeb311b856fabfda36135aed3a37746c38c1ca320e
parentb4d134a0d2ee238cab70f1e967b2172edbec1b41

std.Target: add psp os


5 files changed, 31 insertions(+), 3 deletions(-)

lib/std/Target.zig+18-2
......@@ -53,6 +53,7 @@ pub const Os = struct {
5353 ps3,
5454 ps4,
5555 ps5,
56 psp,
5657 vita,
5758
5859 emscripten,
......@@ -194,6 +195,7 @@ pub const Os = struct {
194195
195196 .@"3ds",
196197
198 .psp,
197199 .vita,
198200
199201 .wasi,
......@@ -612,6 +614,13 @@ pub const Os = struct {
612614 },
613615 },
614616
617 .psp => .{
618 .semver = .{
619 .min = .{ .major = 1, .minor = 0, .patch = 0 },
620 .max = .{ .major = 6, .minor = 61, .patch = 0 },
621 },
622 },
623
615624 .vita => .{
616625 .semver = .{
617626 // 1.3 is the first public release
......@@ -919,6 +928,7 @@ pub const Abi = enum {
919928 .tvos,
920929 .visionos,
921930 .watchos,
931 .psp,
922932 .ps3,
923933 .ps4,
924934 .ps5,
......@@ -2023,7 +2033,10 @@ pub const Cpu = struct {
20232033 .lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.
20242034 .loongarch64 => &loongarch.cpu.la64v1_0,
20252035 .m68k => &m68k.cpu.M68000,
2026 .mips, .mipsel => &mips.cpu.mips32r2,
2036 .mips, .mipsel => switch (os.tag) {
2037 .psp => &mips.cpu.mips2, // mips2 with some custom instructions, no trap instructions
2038 else => &mips.cpu.mips32r2,
2039 },
20272040 .mips64, .mips64el => &mips.cpu.mips64r2,
20282041 .msp430 => &msp430.cpu.msp430,
20292042 .nvptx, .nvptx64 => &nvptx.cpu.sm_52,
......@@ -2204,6 +2217,7 @@ pub fn requiresLibC(target: *const Target) bool {
22042217 .amdhsa,
22052218 .ps4,
22062219 .ps5,
2220 .psp,
22072221 .vita,
22082222 .mesa3d,
22092223 .contiki,
......@@ -2379,6 +2393,7 @@ pub const DynamicLinker = struct {
23792393 .ps3,
23802394 .ps4,
23812395 .ps5,
2396 .psp,
23822397 .vita,
23832398 => .none,
23842399 };
......@@ -2783,6 +2798,7 @@ pub const DynamicLinker = struct {
27832798
27842799 .@"3ds",
27852800
2801 .psp,
27862802 .vita,
27872803
27882804 .emscripten,
......@@ -3338,7 +3354,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
33383354 .longlong, .ulonglong, .double => return 64,
33393355 .longdouble => return 80,
33403356 },
3341 .vita => switch (c_type) {
3357 .psp, .vita => switch (c_type) {
33423358 .char => return 8,
33433359 .short, .ushort => return 16,
33443360 .int, .uint, .float => return 32,
lib/std/heap.zig+10
......@@ -805,6 +805,11 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) {
805805 .x86, .x86_64 => 16 << 10,
806806 else => null,
807807 },
808 .psp => switch (builtin.cpu.arch) {
809 // minimum block allocation by testing sceKernel
810 .mips, .mipsel => 1 << 8, // 256
811 else => null,
812 },
808813 // system/lib/libc/musl/arch/emscripten/bits/limits.h
809814 .emscripten => 64 << 10,
810815 .linux => switch (builtin.cpu.arch) {
......@@ -963,6 +968,11 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) {
963968 .x86, .x86_64 => 16 << 10,
964969 else => null,
965970 },
971 .psp => switch (builtin.cpu.arch) {
972 // minimum block allocation by testing sceKernel
973 .mips, .mipsel => 1 << 8, // 256
974 else => null,
975 },
966976 // system/lib/libc/musl/arch/emscripten/bits/limits.h
967977 .emscripten => 64 << 10,
968978 .linux => switch (builtin.cpu.arch) {
lib/std/start.zig+1-1
......@@ -65,7 +65,7 @@ comptime {
6565 // case it's not required to provide an entrypoint such as main.
6666 if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name });
6767 } else switch (native_os) {
68 .other, .freestanding, .@"3ds", .vita => {},
68 .other, .freestanding, .@"3ds", .psp, .vita => {},
6969 else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }),
7070 }
7171 }
src/Compilation.zig+1
......@@ -6420,6 +6420,7 @@ fn addCommonCCArgs(
64206420 .illumos => try argv.append("__illumos__"),
64216421 // Homebrew targets without LLVM support; use communities's preferred macros.
64226422 .@"3ds" => try argv.append("-D__3DS__"),
6423 .psp => try argv.append("-D__PSP__"),
64236424 .vita => try argv.append("-D__vita__"),
64246425 else => {},
64256426 }
src/codegen/llvm.zig+1
......@@ -247,6 +247,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
247247 .opengl,
248248 .other,
249249 .plan9,
250 .psp,
250251 .vita,
251252 => "unknown",
252253 };