authorgravatar for me@gasinfinity.devGasInfinity <me@gasinfinity.dev> 2025-08-20 22:53:36+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-22 04:14:53+02:00
logcc71936eb9ddb94b163b296e5a8e8c3f2f7c87d4
treeb066aa40763dd0bb8bde5cc2660b60cbff19bce9
parent55daefdb108ea0bf0406dcc3e0569f7b72c639b3

feat(std.Target): add 3ds os


4 files changed, 35 insertions(+), 2 deletions(-)

lib/std/Target.zig+27-2
......@@ -50,6 +50,8 @@ pub const Os = struct {
5050 windows,
5151 uefi,
5252
53 @"3ds",
54
5355 ps3,
5456 ps4,
5557 ps5,
......@@ -194,6 +196,8 @@ pub const Os = struct {
194196
195197 .uefi,
196198
199 .@"3ds",
200
197201 .wasi,
198202
199203 .amdhsa,
......@@ -603,7 +607,12 @@ pub const Os = struct {
603607 .max = .{ .major = 2, .minor = 11, .patch = 0 },
604608 },
605609 },
606
610 .@"3ds" => .{
611 .semver = .{
612 .min = .{ .major = 2, .minor = 27, .patch = 0 }, // 1.0.0-0
613 .max = .{ .major = 2, .minor = 58, .patch = 0 }, // 11.17.0-50
614 },
615 },
607616 .wasi => .{
608617 .semver = .{
609618 .min = .{ .major = 0, .minor = 1, .patch = 0 },
......@@ -861,6 +870,7 @@ pub const Abi = enum {
861870 .tvos, .visionos, .watchos => if (arch == .x86_64) .simulator else .none,
862871 .windows => .gnu,
863872 .uefi => .msvc,
873 .@"3ds" => .eabihf,
864874 .wasi, .emscripten => .musl,
865875
866876 .contiki,
......@@ -1828,7 +1838,10 @@ pub const Cpu = struct {
18281838 pub fn baseline(arch: Arch, os: Os) *const Model {
18291839 return switch (arch) {
18301840 .amdgcn => &amdgcn.cpu.gfx906,
1831 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
1841 .arm, .armeb, .thumb, .thumbeb => switch (os.tag) {
1842 .@"3ds" => &arm.cpu.mpcore,
1843 else => &arm.cpu.baseline,
1844 },
18321845 .aarch64 => switch (os.tag) {
18331846 .driverkit, .macos => &aarch64.cpu.apple_m1,
18341847 .ios, .tvos => &aarch64.cpu.apple_a7,
......@@ -2055,6 +2068,7 @@ pub fn requiresLibC(target: *const Target) bool {
20552068 .vulkan,
20562069 .plan9,
20572070 .other,
2071 .@"3ds",
20582072 => false,
20592073 };
20602074}
......@@ -2153,6 +2167,8 @@ pub const DynamicLinker = struct {
21532167 .uefi,
21542168 .windows,
21552169
2170 .@"3ds",
2171
21562172 .emscripten,
21572173 .wasi,
21582174
......@@ -2537,6 +2553,8 @@ pub const DynamicLinker = struct {
25372553 .uefi,
25382554 .windows,
25392555
2556 .@"3ds",
2557
25402558 .emscripten,
25412559 .wasi,
25422560
......@@ -3044,6 +3062,13 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
30443062 .longdouble => return 128,
30453063 },
30463064
3065 .@"3ds" => switch (c_type) {
3066 .char => return 8,
3067 .short, .ushort => return 16,
3068 .int, .uint, .float, .long, .ulong => return 32,
3069 .longlong, .ulonglong, .double, .longdouble => return 64,
3070 },
3071
30473072 .ps4, .ps5 => switch (c_type) {
30483073 .char => return 8,
30493074 .short, .ushort => return 16,
src/Compilation.zig+5
......@@ -6924,6 +6924,11 @@ pub fn addCCArgs(
69246924 },
69256925 }
69266926
6927 switch (target.os.tag) {
6928 .@"3ds" => try argv.append("-D__3DS__"),
6929 else => {},
6930 }
6931
69276932 if (comp.config.link_libc) {
69286933 if (target.isGnuLibC()) {
69296934 const target_version = target.os.versionRange().gnuLibCVersion().?;
src/codegen/llvm.zig+1
......@@ -228,6 +228,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
228228 .serenity => "serenity",
229229 .vulkan => "vulkan",
230230
231 .@"3ds",
231232 .opengl,
232233 .plan9,
233234 .contiki,
test/llvm_targets.zig+2
......@@ -48,6 +48,7 @@ const targets = [_]std.Target.Query{
4848 .{ .cpu_arch = .arc, .os_tag = .linux, .abi = .gnu },
4949 .{ .cpu_arch = .arc, .os_tag = .linux, .abi = .none },
5050
51 .{ .cpu_arch = .arm, .os_tag = .@"3ds", .abi = .eabihf },
5152 .{ .cpu_arch = .arm, .os_tag = .freebsd, .abi = .eabihf },
5253 .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabi },
5354 .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabihf },
......@@ -250,6 +251,7 @@ const targets = [_]std.Target.Query{
250251 .{ .cpu_arch = .sparc64, .os_tag = .rtems, .abi = .none },
251252 .{ .cpu_arch = .sparc64, .os_tag = .solaris, .abi = .none },
252253
254 .{ .cpu_arch = .thumb, .os_tag = .@"3ds", .abi = .eabihf },
253255 .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabi },
254256 .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabihf },
255257 .{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .eabi },