| 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 | 2591 | uefi, |
| 2592 | 2592 | @"3ds", |
| 2593 | 2593 | wiiu, |
| 2594 | psx, | |
| 2594 | 2595 | ps3, |
| 2595 | 2596 | ps4, |
| 2596 | 2597 | ps5, |
| ... | ... | @@ -2640,6 +2641,7 @@ pub const TargetQuery = struct { |
| 2640 | 2641 | .uefi => .uefi, |
| 2641 | 2642 | .@"3ds" => .@"3ds", |
| 2642 | 2643 | .wiiu => .wiiu, |
| 2644 | .psx => .psx, | |
| 2643 | 2645 | .ps3 => .ps3, |
| 2644 | 2646 | .ps4 => .ps4, |
| 2645 | 2647 | .ps5 => .ps5, |
| ... | ... | @@ -2689,6 +2691,7 @@ pub const TargetQuery = struct { |
| 2689 | 2691 | .uefi => .uefi, |
| 2690 | 2692 | .@"3ds" => .@"3ds", |
| 2691 | 2693 | .wiiu => .wiiu, |
| 2694 | .psx => .psx, | |
| 2692 | 2695 | .ps3 => .ps3, |
| 2693 | 2696 | .ps4 => .ps4, |
| 2694 | 2697 | .ps5 => .ps5, |
lib/std/Target.zig+15-1| ... | ... | @@ -51,6 +51,7 @@ pub const Os = struct { |
| 51 | 51 | @"3ds", |
| 52 | 52 | wiiu, |
| 53 | 53 | |
| 54 | psx, | |
| 54 | 55 | ps3, |
| 55 | 56 | ps4, |
| 56 | 57 | ps5, |
| ... | ... | @@ -166,6 +167,7 @@ pub const Os = struct { |
| 166 | 167 | .plan9, |
| 167 | 168 | .serenity, |
| 168 | 169 | |
| 170 | .psx, | |
| 169 | 171 | .ps3, |
| 170 | 172 | .ps4, |
| 171 | 173 | .ps5, |
| ... | ... | @@ -402,6 +404,7 @@ pub const Os = struct { |
| 402 | 404 | .plan9, |
| 403 | 405 | .serenity, |
| 404 | 406 | |
| 407 | .psx, | |
| 405 | 408 | .ps3, |
| 406 | 409 | .ps4, |
| 407 | 410 | .ps5, |
| ... | ... | @@ -949,6 +952,7 @@ pub const Abi = enum { |
| 949 | 952 | .uefi => .msvc, |
| 950 | 953 | .@"3ds" => .eabihf, |
| 951 | 954 | .wiiu => .eabihf, |
| 955 | .psx => .eabi, | |
| 952 | 956 | .psp => .eabihf, |
| 953 | 957 | .vita => .eabihf, |
| 954 | 958 | .wasi, .emscripten => .musl, |
| ... | ... | @@ -2098,6 +2102,7 @@ pub const Cpu = struct { |
| 2098 | 2102 | .m68k => &m68k.cpu.M68030, |
| 2099 | 2103 | .mips => &mips.cpu.mips32r2, |
| 2100 | 2104 | .mipsel => switch (os.tag) { |
| 2105 | .psx => &mips.cpu.r3000a, | |
| 2101 | 2106 | .psp => &mips.cpu.allegrex, |
| 2102 | 2107 | else => &mips.cpu.mips32r2, |
| 2103 | 2108 | }, |
| ... | ... | @@ -2290,11 +2295,12 @@ pub fn requiresLibC(target: *const Target) bool { |
| 2290 | 2295 | .freestanding, |
| 2291 | 2296 | .fuchsia, |
| 2292 | 2297 | .managarm, |
| 2293 | .ps3, | |
| 2294 | 2298 | .rtems, |
| 2295 | 2299 | .cuda, |
| 2296 | 2300 | .nvcl, |
| 2297 | 2301 | .amdhsa, |
| 2302 | .psx, | |
| 2303 | .ps3, | |
| 2298 | 2304 | .ps4, |
| 2299 | 2305 | .ps5, |
| 2300 | 2306 | .psp, |
| ... | ... | @@ -2475,6 +2481,7 @@ pub const DynamicLinker = struct { |
| 2475 | 2481 | .opengl, |
| 2476 | 2482 | .vulkan, |
| 2477 | 2483 | |
| 2484 | .psx, | |
| 2478 | 2485 | .ps3, |
| 2479 | 2486 | .ps4, |
| 2480 | 2487 | .ps5, |
| ... | ... | @@ -2886,6 +2893,7 @@ pub const DynamicLinker = struct { |
| 2886 | 2893 | .@"3ds", |
| 2887 | 2894 | .wiiu, |
| 2888 | 2895 | |
| 2896 | .psx, | |
| 2889 | 2897 | .psp, |
| 2890 | 2898 | .vita, |
| 2891 | 2899 | |
| ... | ... | @@ -3445,6 +3453,12 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { |
| 3445 | 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 | 3462 | .ps4, .ps5 => switch (c_type) { |
| 3449 | 3463 | .char => return 8, |
| 3450 | 3464 | .short, .ushort => return 16, |
lib/std/Target/mips.zig+9| ... | ... | @@ -587,4 +587,13 @@ pub const cpu = struct { |
| 587 | 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 | 507 | if (use_trap_panic) @trap(); |
| 508 | 508 | |
| 509 | 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 | 520 | @trap(); |
| 512 | 521 | }, |
| 513 | 522 | .uefi => { |
lib/std/start.zig+13-1| ... | ... | @@ -70,7 +70,19 @@ comptime { |
| 70 | 70 | // case it's not required to provide an entrypoint such as main. |
| 71 | 71 | if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name }); |
| 72 | 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 | 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 | 6354 | // Homebrew targets without LLVM support; use communities's preferred macros. |
| 6355 | 6355 | .@"3ds" => try argv.append("-D__3DS__"), |
| 6356 | 6356 | .wiiu => try argv.append("-D__WIIU__"), |
| 6357 | .psx => try argv.append("-D__psx__"), | |
| 6357 | 6358 | .psp => try argv.append("-D__PSP__"), |
| 6358 | 6359 | .vita => try argv.append("-D__vita__"), |
| 6359 | 6360 | else => {}, |
src/codegen/llvm.zig+2-1| ... | ... | @@ -243,9 +243,10 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 |
| 243 | 243 | .opengl, |
| 244 | 244 | .other, |
| 245 | 245 | .plan9, |
| 246 | .psx, | |
| 246 | 247 | .psp, |
| 247 | .tios, | |
| 248 | 248 | .vita, |
| 249 | .tios, | |
| 249 | 250 | .wiiu, |
| 250 | 251 | => "unknown", |
| 251 | 252 | }; |
test/llvm_targets.zig+1| ... | ... | @@ -154,6 +154,7 @@ const targets = [_]std.Target.Query{ |
| 154 | 154 | .{ .cpu_arch = .mipsel, .os_tag = .linux, .abi = .musleabihf }, |
| 155 | 155 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabi }, |
| 156 | 156 | .{ .cpu_arch = .mipsel, .os_tag = .netbsd, .abi = .eabihf }, |
| 157 | .{ .cpu_arch = .mipsel, .os_tag = .psx, .abi = .eabi }, | |
| 157 | 158 | .{ .cpu_arch = .mipsel, .os_tag = .psp, .abi = .eabihf }, |
| 158 | 159 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabi }, |
| 159 | 160 | .{ .cpu_arch = .mipsel, .os_tag = .rtems, .abi = .eabihf }, |
tools/update_cpu_features.zig+9| ... | ... | @@ -1358,6 +1358,15 @@ const targets = [_]ArchTarget{ |
| 1358 | 1358 | }, |
| 1359 | 1359 | }, |
| 1360 | 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 | 1371 | .llvm_name = null, |
| 1363 | 1372 | .zig_name = "allegrex", |