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 {...@@ -53,6 +53,7 @@ pub const Os = struct {
53 ps3,53 ps3,
54 ps4,54 ps4,
55 ps5,55 ps5,
56 psp,
56 vita,57 vita,
5758
58 emscripten,59 emscripten,
...@@ -194,6 +195,7 @@ pub const Os = struct {...@@ -194,6 +195,7 @@ pub const Os = struct {
194195
195 .@"3ds",196 .@"3ds",
196197
198 .psp,
197 .vita,199 .vita,
198200
199 .wasi,201 .wasi,
...@@ -612,6 +614,13 @@ pub const Os = struct {...@@ -612,6 +614,13 @@ pub const Os = struct {
612 },614 },
613 },615 },
614616
617 .psp => .{
618 .semver = .{
619 .min = .{ .major = 1, .minor = 0, .patch = 0 },
620 .max = .{ .major = 6, .minor = 61, .patch = 0 },
621 },
622 },
623
615 .vita => .{624 .vita => .{
616 .semver = .{625 .semver = .{
617 // 1.3 is the first public release626 // 1.3 is the first public release
...@@ -919,6 +928,7 @@ pub const Abi = enum {...@@ -919,6 +928,7 @@ pub const Abi = enum {
919 .tvos,928 .tvos,
920 .visionos,929 .visionos,
921 .watchos,930 .watchos,
931 .psp,
922 .ps3,932 .ps3,
923 .ps4,933 .ps4,
924 .ps5,934 .ps5,
...@@ -2023,7 +2033,10 @@ pub const Cpu = struct {...@@ -2023,7 +2033,10 @@ pub const Cpu = struct {
2023 .lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.2033 .lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.
2024 .loongarch64 => &loongarch.cpu.la64v1_0,2034 .loongarch64 => &loongarch.cpu.la64v1_0,
2025 .m68k => &m68k.cpu.M68000,2035 .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 },
2027 .mips64, .mips64el => &mips.cpu.mips64r2,2040 .mips64, .mips64el => &mips.cpu.mips64r2,
2028 .msp430 => &msp430.cpu.msp430,2041 .msp430 => &msp430.cpu.msp430,
2029 .nvptx, .nvptx64 => &nvptx.cpu.sm_52,2042 .nvptx, .nvptx64 => &nvptx.cpu.sm_52,
...@@ -2204,6 +2217,7 @@ pub fn requiresLibC(target: *const Target) bool {...@@ -2204,6 +2217,7 @@ pub fn requiresLibC(target: *const Target) bool {
2204 .amdhsa,2217 .amdhsa,
2205 .ps4,2218 .ps4,
2206 .ps5,2219 .ps5,
2220 .psp,
2207 .vita,2221 .vita,
2208 .mesa3d,2222 .mesa3d,
2209 .contiki,2223 .contiki,
...@@ -2379,6 +2393,7 @@ pub const DynamicLinker = struct {...@@ -2379,6 +2393,7 @@ pub const DynamicLinker = struct {
2379 .ps3,2393 .ps3,
2380 .ps4,2394 .ps4,
2381 .ps5,2395 .ps5,
2396 .psp,
2382 .vita,2397 .vita,
2383 => .none,2398 => .none,
2384 };2399 };
...@@ -2783,6 +2798,7 @@ pub const DynamicLinker = struct {...@@ -2783,6 +2798,7 @@ pub const DynamicLinker = struct {
27832798
2784 .@"3ds",2799 .@"3ds",
27852800
2801 .psp,
2786 .vita,2802 .vita,
27872803
2788 .emscripten,2804 .emscripten,
...@@ -3338,7 +3354,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {...@@ -3338,7 +3354,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3338 .longlong, .ulonglong, .double => return 64,3354 .longlong, .ulonglong, .double => return 64,
3339 .longdouble => return 80,3355 .longdouble => return 80,
3340 },3356 },
3341 .vita => switch (c_type) {3357 .psp, .vita => switch (c_type) {
3342 .char => return 8,3358 .char => return 8,
3343 .short, .ushort => return 16,3359 .short, .ushort => return 16,
3344 .int, .uint, .float => return 32,3360 .int, .uint, .float => return 32,
lib/std/heap.zig+10
...@@ -805,6 +805,11 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) {...@@ -805,6 +805,11 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) {
805 .x86, .x86_64 => 16 << 10,805 .x86, .x86_64 => 16 << 10,
806 else => null,806 else => null,
807 },807 },
808 .psp => switch (builtin.cpu.arch) {
809 // minimum block allocation by testing sceKernel
810 .mips, .mipsel => 1 << 8, // 256
811 else => null,
812 },
808 // system/lib/libc/musl/arch/emscripten/bits/limits.h813 // system/lib/libc/musl/arch/emscripten/bits/limits.h
809 .emscripten => 64 << 10,814 .emscripten => 64 << 10,
810 .linux => switch (builtin.cpu.arch) {815 .linux => switch (builtin.cpu.arch) {
...@@ -963,6 +968,11 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) {...@@ -963,6 +968,11 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) {
963 .x86, .x86_64 => 16 << 10,968 .x86, .x86_64 => 16 << 10,
964 else => null,969 else => null,
965 },970 },
971 .psp => switch (builtin.cpu.arch) {
972 // minimum block allocation by testing sceKernel
973 .mips, .mipsel => 1 << 8, // 256
974 else => null,
975 },
966 // system/lib/libc/musl/arch/emscripten/bits/limits.h976 // system/lib/libc/musl/arch/emscripten/bits/limits.h
967 .emscripten => 64 << 10,977 .emscripten => 64 << 10,
968 .linux => switch (builtin.cpu.arch) {978 .linux => switch (builtin.cpu.arch) {
lib/std/start.zig+1-1
...@@ -65,7 +65,7 @@ comptime {...@@ -65,7 +65,7 @@ comptime {
65 // case it's not required to provide an entrypoint such as main.65 // case it's not required to provide an entrypoint such as main.
66 if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name });66 if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name });
67 } else switch (native_os) {67 } else switch (native_os) {
68 .other, .freestanding, .@"3ds", .vita => {},68 .other, .freestanding, .@"3ds", .psp, .vita => {},
69 else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }),69 else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }),
70 }70 }
71 }71 }
src/Compilation.zig+1
...@@ -6420,6 +6420,7 @@ fn addCommonCCArgs(...@@ -6420,6 +6420,7 @@ fn addCommonCCArgs(
6420 .illumos => try argv.append("__illumos__"),6420 .illumos => try argv.append("__illumos__"),
6421 // Homebrew targets without LLVM support; use communities's preferred macros.6421 // Homebrew targets without LLVM support; use communities's preferred macros.
6422 .@"3ds" => try argv.append("-D__3DS__"),6422 .@"3ds" => try argv.append("-D__3DS__"),
6423 .psp => try argv.append("-D__PSP__"),
6423 .vita => try argv.append("-D__vita__"),6424 .vita => try argv.append("-D__vita__"),
6424 else => {},6425 else => {},
6425 }6426 }
src/codegen/llvm.zig+1
...@@ -247,6 +247,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8...@@ -247,6 +247,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
247 .opengl,247 .opengl,
248 .other,248 .other,
249 .plan9,249 .plan9,
250 .psp,
250 .vita,251 .vita,
251 => "unknown",252 => "unknown",
252 };253 };