| author | |
| committer | |
| log | 164578636cfe760ab03f8f37f039ca7e5a0c801b |
| tree | b4bbe112805fccf4570d1a7256d355c176fc48b2 |
| parent | a3c08eccbe30255b744ba14dca0061b396a84bab |
| signature |
contributes to https://codeberg.org/ziglang/zig/issues/313418 files changed, 39 insertions(+), 5 deletions(-)
lib/std/Build/Configuration.zig+3| ... | ... | @@ -2618,6 +2618,7 @@ pub const TargetQuery = struct { |
| 2618 | 2618 | uefi, |
| 2619 | 2619 | @"3ds", |
| 2620 | 2620 | wiiu, |
| 2621 | @"switch", | |
| 2621 | 2622 | psx, |
| 2622 | 2623 | ps3, |
| 2623 | 2624 | ps4, |
| ... | ... | @@ -2669,6 +2670,7 @@ pub const TargetQuery = struct { |
| 2669 | 2670 | .uefi => .uefi, |
| 2670 | 2671 | .@"3ds" => .@"3ds", |
| 2671 | 2672 | .wiiu => .wiiu, |
| 2673 | .@"switch" => .@"switch", | |
| 2672 | 2674 | .psx => .psx, |
| 2673 | 2675 | .ps3 => .ps3, |
| 2674 | 2676 | .ps4 => .ps4, |
| ... | ... | @@ -2720,6 +2722,7 @@ pub const TargetQuery = struct { |
| 2720 | 2722 | .uefi => .uefi, |
| 2721 | 2723 | .@"3ds" => .@"3ds", |
| 2722 | 2724 | .wiiu => .wiiu, |
| 2725 | .@"switch" => .@"switch", | |
| 2723 | 2726 | .psx => .psx, |
| 2724 | 2727 | .ps3 => .ps3, |
| 2725 | 2728 | .ps4 => .ps4, |
lib/std/Target.zig+23-1| ... | ... | @@ -50,6 +50,7 @@ pub const Os = struct { |
| 50 | 50 | |
| 51 | 51 | @"3ds", |
| 52 | 52 | wiiu, |
| 53 | @"switch", | |
| 53 | 54 | |
| 54 | 55 | psx, |
| 55 | 56 | ps3, |
| ... | ... | @@ -196,6 +197,7 @@ pub const Os = struct { |
| 196 | 197 | |
| 197 | 198 | .@"3ds", |
| 198 | 199 | .wiiu, |
| 200 | .@"switch", | |
| 199 | 201 | |
| 200 | 202 | .psp, |
| 201 | 203 | .vita, |
| ... | ... | @@ -632,6 +634,13 @@ pub const Os = struct { |
| 632 | 634 | }, |
| 633 | 635 | }, |
| 634 | 636 | |
| 637 | .@"switch" => .{ | |
| 638 | .semver = .{ | |
| 639 | .min = .{ .major = 1, .minor = 0, .patch = 0 }, | |
| 640 | .max = .{ .major = 22, .minor = 5, .patch = 0 }, | |
| 641 | }, | |
| 642 | }, | |
| 643 | ||
| 635 | 644 | .psp => .{ |
| 636 | 645 | .semver = .{ |
| 637 | 646 | // https://www.psdevwiki.com/psp/Official_Firmware_(OFW)#1.XX_Kernel |
| ... | ... | @@ -944,6 +953,7 @@ pub const Abi = enum { |
| 944 | 953 | .tvos, |
| 945 | 954 | .visionos, |
| 946 | 955 | .watchos, |
| 956 | .@"switch", | |
| 947 | 957 | .ps3, |
| 948 | 958 | .ps4, |
| 949 | 959 | .ps5, |
| ... | ... | @@ -2040,6 +2050,7 @@ pub const Cpu = struct { |
| 2040 | 2050 | .ios, .tvos => &aarch64.cpu.apple_a7, |
| 2041 | 2051 | .visionos => &aarch64.cpu.apple_m2, |
| 2042 | 2052 | .watchos => &aarch64.cpu.apple_s4, |
| 2053 | .@"switch" => &aarch64.cpu.cortex_a57, | |
| 2043 | 2054 | else => generic(arch), |
| 2044 | 2055 | }, |
| 2045 | 2056 | .avr => &avr.cpu.avr2, |
| ... | ... | @@ -2271,8 +2282,9 @@ pub fn requiresLibC(target: *const Target) bool { |
| 2271 | 2282 | .plan9, |
| 2272 | 2283 | .other, |
| 2273 | 2284 | .@"3ds", |
| 2274 | .tios, | |
| 2275 | 2285 | .wiiu, |
| 2286 | .@"switch", | |
| 2287 | .tios, | |
| 2276 | 2288 | .ashetos, |
| 2277 | 2289 | => false, |
| 2278 | 2290 | }; |
| ... | ... | @@ -2421,6 +2433,7 @@ pub const DynamicLinker = struct { |
| 2421 | 2433 | |
| 2422 | 2434 | .@"3ds", |
| 2423 | 2435 | .wiiu, |
| 2436 | .@"switch", | |
| 2424 | 2437 | |
| 2425 | 2438 | .emscripten, |
| 2426 | 2439 | .wasi, |
| ... | ... | @@ -2845,6 +2858,7 @@ pub const DynamicLinker = struct { |
| 2845 | 2858 | |
| 2846 | 2859 | .@"3ds", |
| 2847 | 2860 | .wiiu, |
| 2861 | .@"switch", | |
| 2848 | 2862 | |
| 2849 | 2863 | .psx, |
| 2850 | 2864 | .psp, |
| ... | ... | @@ -3410,6 +3424,14 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { |
| 3410 | 3424 | .longlong, .ulonglong, .double, .longdouble => return 64, |
| 3411 | 3425 | }, |
| 3412 | 3426 | |
| 3427 | .@"switch" => switch (c_type) { | |
| 3428 | .char => return 8, | |
| 3429 | .short, .ushort => return 16, | |
| 3430 | .int, .uint, .float => return 32, | |
| 3431 | .long, .ulong, .longlong, .ulonglong, .double => return 64, | |
| 3432 | .longdouble => return 128, | |
| 3433 | }, | |
| 3434 | ||
| 3413 | 3435 | .psx => switch (c_type) { |
| 3414 | 3436 | .char => return 8, |
| 3415 | 3437 | .short, .ushort => return 16, |
lib/std/debug.zig+1| ... | ... | @@ -511,6 +511,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn { |
| 511 | 511 | |
| 512 | 512 | .@"3ds", |
| 513 | 513 | .wiiu, |
| 514 | .@"switch", | |
| 514 | 515 | |
| 515 | 516 | .psx, |
| 516 | 517 | .psp, |
lib/std/start.zig+1| ... | ... | @@ -78,6 +78,7 @@ comptime { |
| 78 | 78 | |
| 79 | 79 | .@"3ds", |
| 80 | 80 | .wiiu, |
| 81 | .@"switch", | |
| 81 | 82 | |
| 82 | 83 | .psx, |
| 83 | 84 | .psp, |
src/Compilation.zig+1| ... | ... | @@ -6196,6 +6196,7 @@ fn addCommonCCArgs( |
| 6196 | 6196 | // Homebrew targets without LLVM support; use communities's preferred macros. |
| 6197 | 6197 | .@"3ds" => try argv.append("-D__3DS__"), |
| 6198 | 6198 | .wiiu => try argv.append("-D__WIIU__"), |
| 6199 | .@"switch" => try argv.append("-D__SWITCH__"), | |
| 6199 | 6200 | .psx => try argv.append("-D__psx__"), |
| 6200 | 6201 | .psp => try argv.append("-D__PSP__"), |
| 6201 | 6202 | .vita => try argv.append("-D__vita__"), |
src/codegen/llvm.zig+2-1| ... | ... | @@ -239,7 +239,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 |
| 239 | 239 | .vulkan => "vulkan", |
| 240 | 240 | .managarm => "managarm", |
| 241 | 241 | |
| 242 | .@"3ds", | |
| 243 | 242 | .contiki, |
| 244 | 243 | .freestanding, |
| 245 | 244 | .opencl, // https://llvm.org/docs/SPIRVUsage.html#target-triples |
| ... | ... | @@ -250,7 +249,9 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 |
| 250 | 249 | .psp, |
| 251 | 250 | .vita, |
| 252 | 251 | .tios, |
| 252 | .@"3ds", | |
| 253 | 253 | .wiiu, |
| 254 | .@"switch", | |
| 254 | 255 | .ashetos, |
| 255 | 256 | => "unknown", |
| 256 | 257 | }; |
src/target.zig+7-3| ... | ... | @@ -62,9 +62,13 @@ pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool { |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | pub fn requiresPie(target: *const std.Target, link_mode: std.lang.LinkMode) bool { |
| 65 | return target.os.tag == .fuchsia or | |
| 66 | (target.abi.isAndroid() and link_mode == .dynamic) or | |
| 67 | target.os.tag == .ashetos; | |
| 65 | return switch (target.os.tag) { | |
| 66 | .ashetos, | |
| 67 | .fuchsia, | |
| 68 | .@"switch", | |
| 69 | => true, | |
| 70 | else => target.abi.isAndroid() and link_mode == .dynamic, | |
| 71 | }; | |
| 68 | 72 | } |
| 69 | 73 | |
| 70 | 74 | /// This function returns whether non-pic code is completely invalid on the given target. |
test/llvm_targets.zig+1| ... | ... | @@ -22,6 +22,7 @@ const targets = [_]std.Target.Query{ |
| 22 | 22 | .{ .cpu_arch = .aarch64, .os_tag = .openbsd, .abi = .none }, |
| 23 | 23 | .{ .cpu_arch = .aarch64, .os_tag = .rtems, .abi = .none }, |
| 24 | 24 | .{ .cpu_arch = .aarch64, .os_tag = .serenity, .abi = .none }, |
| 25 | .{ .cpu_arch = .aarch64, .os_tag = .@"switch", .abi = .none }, | |
| 25 | 26 | .{ .cpu_arch = .aarch64, .os_tag = .tvos, .abi = .none }, |
| 26 | 27 | .{ .cpu_arch = .aarch64, .os_tag = .tvos, .abi = .simulator }, |
| 27 | 28 | .{ .cpu_arch = .aarch64, .os_tag = .uefi, .abi = .none }, |