| author | |
| committer | |
| log | 84f84267c72b12d4562d53df33e3c0121c7e5cee |
| tree | 66b3241a814e73c2abaed7dd185275a062940802 |
| parent | d5446652fa22db2e771be9af6ab755e8b199b5c9 |
Adds target info for the PSX. Builds fine with the following:
```zig
const target = b.resolveTargetQuery(.{
.os_tag = .psx,
.cpu_arch = .mipsel,
});
```
the only "problem" being that it spits out an error from LLVM even
though generating an object file succeeds:
```sh
❯ zig build
install
└─ install generated to main.o
└─ compile obj obj Debug mipsel-psx failure
error: warning: MIPS-I support is experimental
```9 files changed, 63 insertions(+), 4 deletions(-)
lib/std/Build/Configuration.zig+3| ... | @@ -2591,6 +2591,7 @@ pub const TargetQuery = struct { | ... | @@ -2591,6 +2591,7 @@ pub const TargetQuery = struct { |
| 2591 | uefi, | 2591 | uefi, |
| 2592 | @"3ds", | 2592 | @"3ds", |
| 2593 | wiiu, | 2593 | wiiu, |
| 2594 | psx, | ||
| 2594 | ps3, | 2595 | ps3, |
| 2595 | ps4, | 2596 | ps4, |
| 2596 | ps5, | 2597 | ps5, |
| ... | @@ -2640,6 +2641,7 @@ pub const TargetQuery = struct { | ... | @@ -2640,6 +2641,7 @@ pub const TargetQuery = struct { |
| 2640 | .uefi => .uefi, | 2641 | .uefi => .uefi, |
| 2641 | .@"3ds" => .@"3ds", | 2642 | .@"3ds" => .@"3ds", |
| 2642 | .wiiu => .wiiu, | 2643 | .wiiu => .wiiu, |
| 2644 | .psx => .psx, | ||
| 2643 | .ps3 => .ps3, | 2645 | .ps3 => .ps3, |
| 2644 | .ps4 => .ps4, | 2646 | .ps4 => .ps4, |
| 2645 | .ps5 => .ps5, | 2647 | .ps5 => .ps5, |
| ... | @@ -2689,6 +2691,7 @@ pub const TargetQuery = struct { | ... | @@ -2689,6 +2691,7 @@ pub const TargetQuery = struct { |
| 2689 | .uefi => .uefi, | 2691 | .uefi => .uefi, |
| 2690 | .@"3ds" => .@"3ds", | 2692 | .@"3ds" => .@"3ds", |
| 2691 | .wiiu => .wiiu, | 2693 | .wiiu => .wiiu, |
| 2694 | .psx => .psx, | ||
| 2692 | .ps3 => .ps3, | 2695 | .ps3 => .ps3, |
| 2693 | .ps4 => .ps4, | 2696 | .ps4 => .ps4, |
| 2694 | .ps5 => .ps5, | 2697 | .ps5 => .ps5, |
lib/std/Target.zig+15-1| ... | @@ -51,6 +51,7 @@ pub const Os = struct { | ... | @@ -51,6 +51,7 @@ pub const Os = struct { |
| 51 | @"3ds", | 51 | @"3ds", |
| 52 | wiiu, | 52 | wiiu, |
| 53 | 53 | ||
| 54 | psx, | ||
| 54 | ps3, | 55 | ps3, |
| 55 | ps4, | 56 | ps4, |
| 56 | ps5, | 57 | ps5, |
| ... | @@ -166,6 +167,7 @@ pub const Os = struct { | ... | @@ -166,6 +167,7 @@ pub const Os = struct { |
| 166 | .plan9, | 167 | .plan9, |
| 167 | .serenity, | 168 | .serenity, |
| 168 | 169 | ||
| 170 | .psx, | ||
| 169 | .ps3, | 171 | .ps3, |
| 170 | .ps4, | 172 | .ps4, |
| 171 | .ps5, | 173 | .ps5, |
| ... | @@ -402,6 +404,7 @@ pub const Os = struct { | ... | @@ -402,6 +404,7 @@ pub const Os = struct { |
| 402 | .plan9, | 404 | .plan9, |
| 403 | .serenity, | 405 | .serenity, |
| 404 | 406 | ||
| 407 | .psx, | ||
| 405 | .ps3, | 408 | .ps3, |
| 406 | .ps4, | 409 | .ps4, |
| 407 | .ps5, | 410 | .ps5, |
| ... | @@ -949,6 +952,7 @@ pub const Abi = enum { | ... | @@ -949,6 +952,7 @@ pub const Abi = enum { |
| 949 | .uefi => .msvc, | 952 | .uefi => .msvc, |
| 950 | .@"3ds" => .eabihf, | 953 | .@"3ds" => .eabihf, |
| 951 | .wiiu => .eabihf, | 954 | .wiiu => .eabihf, |
| 955 | .psx => .eabi, | ||
| 952 | .psp => .eabihf, | 956 | .psp => .eabihf, |
| 953 | .vita => .eabihf, | 957 | .vita => .eabihf, |
| 954 | .wasi, .emscripten => .musl, | 958 | .wasi, .emscripten => .musl, |
| ... | @@ -2098,6 +2102,7 @@ pub const Cpu = struct { | ... | @@ -2098,6 +2102,7 @@ pub const Cpu = struct { |
| 2098 | .m68k => &m68k.cpu.M68030, | 2102 | .m68k => &m68k.cpu.M68030, |
| 2099 | .mips => &mips.cpu.mips32r2, | 2103 | .mips => &mips.cpu.mips32r2, |
| 2100 | .mipsel => switch (os.tag) { | 2104 | .mipsel => switch (os.tag) { |
| 2105 | .psx => &mips.cpu.r3000a, | ||
| 2101 | .psp => &mips.cpu.allegrex, | 2106 | .psp => &mips.cpu.allegrex, |
| 2102 | else => &mips.cpu.mips32r2, | 2107 | else => &mips.cpu.mips32r2, |
| 2103 | }, | 2108 | }, |
| ... | @@ -2290,11 +2295,12 @@ pub fn requiresLibC(target: *const Target) bool { | ... | @@ -2290,11 +2295,12 @@ pub fn requiresLibC(target: *const Target) bool { |
| 2290 | .freestanding, | 2295 | .freestanding, |
| 2291 | .fuchsia, | 2296 | .fuchsia, |
| 2292 | .managarm, | 2297 | .managarm, |
| 2293 | .ps3, | ||
| 2294 | .rtems, | 2298 | .rtems, |
| 2295 | .cuda, | 2299 | .cuda, |
| 2296 | .nvcl, | 2300 | .nvcl, |
| 2297 | .amdhsa, | 2301 | .amdhsa, |
| 2302 | .psx, | ||
| 2303 | .ps3, | ||
| 2298 | .ps4, | 2304 | .ps4, |
| 2299 | .ps5, | 2305 | .ps5, |
| 2300 | .psp, | 2306 | .psp, |
| ... | @@ -2475,6 +2481,7 @@ pub const DynamicLinker = struct { | ... | @@ -2475,6 +2481,7 @@ pub const DynamicLinker = struct { |
| 2475 | .opengl, | 2481 | .opengl, |
| 2476 | .vulkan, | 2482 | .vulkan, |
| 2477 | 2483 | ||
| 2484 | .psx, | ||
| 2478 | .ps3, | 2485 | .ps3, |
| 2479 | .ps4, | 2486 | .ps4, |
| 2480 | .ps5, | 2487 | .ps5, |
| ... | @@ -2886,6 +2893,7 @@ pub const DynamicLinker = struct { | ... | @@ -2886,6 +2893,7 @@ pub const DynamicLinker = struct { |
| 2886 | .@"3ds", | 2893 | .@"3ds", |
| 2887 | .wiiu, | 2894 | .wiiu, |
| 2888 | 2895 | ||
| 2896 | .psx, | ||
| 2889 | .psp, | 2897 | .psp, |
| 2890 | .vita, | 2898 | .vita, |
| 2891 | 2899 | ||
| ... | @@ -3445,6 +3453,12 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { | ... | @@ -3445,6 +3453,12 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { |
| 3445 | .longlong, .ulonglong, .double, .longdouble => return 64, | 3453 | .longlong, .ulonglong, .double, .longdouble => return 64, |
| 3446 | }, | 3454 | }, |
| 3447 | 3455 | ||
| 3456 | .psx => switch (c_type) { | ||
| 3457 | .char => return 8, | ||
| 3458 | .short, .ushort => return 16, | ||
| 3459 | .int, .uint, .long, .ulong, .float => return 32, | ||
| 3460 | .longlong, .ulonglong, .double, .longdouble => return 64, | ||
| 3461 | }, | ||
| 3448 | .ps4, .ps5 => switch (c_type) { | 3462 | .ps4, .ps5 => switch (c_type) { |
| 3449 | .char => return 8, | 3463 | .char => return 8, |
| 3450 | .short, .ushort => return 16, | 3464 | .short, .ushort => return 16, |
lib/std/Target/mips.zig+9| ... | @@ -587,4 +587,13 @@ pub const cpu = struct { | ... | @@ -587,4 +587,13 @@ pub const cpu = struct { |
| 587 | .p5600, | 587 | .p5600, |
| 588 | }), | 588 | }), |
| 589 | }; | 589 | }; |
| 590 | pub const r3000a: CpuModel = .{ | ||
| 591 | .name = "r3000a", | ||
| 592 | .llvm_name = null, | ||
| 593 | .features = featureSet(&[_]Feature{ | ||
| 594 | .mips1, | ||
| 595 | .notraps, | ||
| 596 | .soft_float, | ||
| 597 | }), | ||
| 598 | }; | ||
| 590 | }; | 599 | }; |
lib/std/debug.zig+10-1| ... | @@ -507,7 +507,16 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn { | ... | @@ -507,7 +507,16 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn { |
| 507 | if (use_trap_panic) @trap(); | 507 | if (use_trap_panic) @trap(); |
| 508 | 508 | ||
| 509 | switch (builtin.os.tag) { | 509 | switch (builtin.os.tag) { |
| 510 | .freestanding, .other, .@"3ds", .wiiu, .psp, .vita => { | 510 | .freestanding, |
| 511 | .other, | ||
| 512 | |||
| 513 | .@"3ds", | ||
| 514 | .wiiu, | ||
| 515 | |||
| 516 | .psx, | ||
| 517 | .psp, | ||
| 518 | .vita, | ||
| 519 | => { | ||
| 511 | @trap(); | 520 | @trap(); |
| 512 | }, | 521 | }, |
| 513 | .uefi => { | 522 | .uefi => { |
lib/std/start.zig+13-1| ... | @@ -70,7 +70,19 @@ comptime { | ... | @@ -70,7 +70,19 @@ comptime { |
| 70 | // case it's not required to provide an entrypoint such as main. | 70 | // case it's not required to provide an entrypoint such as main. |
| 71 | if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name }); | 71 | if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name }); |
| 72 | } else switch (native_os) { | 72 | } else switch (native_os) { |
| 73 | .other, .freestanding, .@"3ds", .wiiu, .psp, .vita, .vulkan, .opengl, .opencl => {}, | 73 | .other, |
| 74 | .freestanding, | ||
| 75 | .vulkan, | ||
| 76 | .opengl, | ||
| 77 | .opencl, | ||
| 78 | |||
| 79 | .@"3ds", | ||
| 80 | .wiiu, | ||
| 81 | |||
| 82 | .psx, | ||
| 83 | .psp, | ||
| 84 | .vita, | ||
| 85 | => {}, | ||
| 74 | else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }), | 86 | else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }), |
| 75 | } | 87 | } |
| 76 | } | 88 | } |
src/Compilation.zig+1| ... | @@ -6354,6 +6354,7 @@ fn addCommonCCArgs( | ... | @@ -6354,6 +6354,7 @@ fn addCommonCCArgs( |
| 6354 | // Homebrew targets without LLVM support; use communities's preferred macros. | 6354 | // Homebrew targets without LLVM support; use communities's preferred macros. |
| 6355 | .@"3ds" => try argv.append("-D__3DS__"), | 6355 | .@"3ds" => try argv.append("-D__3DS__"), |
| 6356 | .wiiu => try argv.append("-D__WIIU__"), | 6356 | .wiiu => try argv.append("-D__WIIU__"), |
| 6357 | .psx => try argv.append("-D__psx__"), | ||
| 6357 | .psp => try argv.append("-D__PSP__"), | 6358 | .psp => try argv.append("-D__PSP__"), |
| 6358 | .vita => try argv.append("-D__vita__"), | 6359 | .vita => try argv.append("-D__vita__"), |
| 6359 | else => {}, | 6360 | else => {}, |
src/codegen/llvm.zig+2-1| ... | @@ -243,9 +243,10 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 | ... | @@ -243,9 +243,10 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 |
| 243 | .opengl, | 243 | .opengl, |
| 244 | .other, | 244 | .other, |
| 245 | .plan9, | 245 | .plan9, |
| 246 | .psx, | ||
| 246 | .psp, | 247 | .psp, |
| 247 | .tios, | ||
| 248 | .vita, | 248 | .vita, |
| 249 | .tios, | ||
| 249 | .wiiu, | 250 | .wiiu, |
| 250 | => "unknown", | 251 | => "unknown", |
| 251 | }; | 252 | }; |
test/llvm_targets.zig+1| ... | @@ -154,6 +154,7 @@ const targets = [_]std.Target.Query{ | ... | @@ -154,6 +154,7 @@ const targets = [_]std.Target.Query{ |
| 154 | .{ .cpu_arch = .mipsel, .os_tag = .linux, .abi = .musleabihf }, | 154 | .{ .cpu_arch = .mipsel, .os_tag = .linux, .abi = .musleabihf }, |
| 155 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabi }, | 155 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabi }, |
| 156 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabihf }, | 156 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabihf }, |
| 157 | .{ .cpu_arch = .mipsel, .os_tag = .psx, .abi = .eabi }, | ||
| 157 | .{ .cpu_arch = .mipsel, .os_tag = .psp, .abi = .eabihf }, | 158 | .{ .cpu_arch = .mipsel, .os_tag = .psp, .abi = .eabihf }, |
| 158 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabi }, | 159 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabi }, |
| 159 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabihf }, | 160 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabihf }, |
tools/update_cpu_features.zig+9| ... | @@ -1358,6 +1358,15 @@ const targets = [_]ArchTarget{ | ... | @@ -1358,6 +1358,15 @@ const targets = [_]ArchTarget{ |
| 1358 | }, | 1358 | }, |
| 1359 | }, | 1359 | }, |
| 1360 | .extra_cpus = &.{ | 1360 | .extra_cpus = &.{ |
| 1361 | .{ | ||
| 1362 | .llvm_name = null, | ||
| 1363 | .zig_name = "r3000a", | ||
| 1364 | .features = &.{ | ||
| 1365 | "mips1", | ||
| 1366 | "soft_float", | ||
| 1367 | "notraps", | ||
| 1368 | }, | ||
| 1369 | }, | ||
| 1361 | .{ | 1370 | .{ |
| 1362 | .llvm_name = null, | 1371 | .llvm_name = null, |
| 1363 | .zig_name = "allegrex", | 1372 | .zig_name = "allegrex", |