diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 2aa3e0a70c..3ec14336c8 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -50,6 +50,8 @@ pub const Os = struct { windows, uefi, + @"3ds", + ps3, ps4, ps5, @@ -194,6 +196,8 @@ pub const Os = struct { .uefi, + .@"3ds", + .wasi, .amdhsa, @@ -603,7 +607,12 @@ pub const Os = struct { .max = .{ .major = 2, .minor = 11, .patch = 0 }, }, }, - + .@"3ds" => .{ + .semver = .{ + .min = .{ .major = 2, .minor = 27, .patch = 0 }, // 1.0.0-0 + .max = .{ .major = 2, .minor = 58, .patch = 0 }, // 11.17.0-50 + }, + }, .wasi => .{ .semver = .{ .min = .{ .major = 0, .minor = 1, .patch = 0 }, @@ -861,6 +870,7 @@ pub const Abi = enum { .tvos, .visionos, .watchos => if (arch == .x86_64) .simulator else .none, .windows => .gnu, .uefi => .msvc, + .@"3ds" => .eabihf, .wasi, .emscripten => .musl, .contiki, @@ -1828,7 +1838,10 @@ pub const Cpu = struct { pub fn baseline(arch: Arch, os: Os) *const Model { return switch (arch) { .amdgcn => &amdgcn.cpu.gfx906, - .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline, + .arm, .armeb, .thumb, .thumbeb => switch (os.tag) { + .@"3ds" => &arm.cpu.mpcore, + else => &arm.cpu.baseline, + }, .aarch64 => switch (os.tag) { .driverkit, .macos => &aarch64.cpu.apple_m1, .ios, .tvos => &aarch64.cpu.apple_a7, @@ -2055,6 +2068,7 @@ pub fn requiresLibC(target: *const Target) bool { .vulkan, .plan9, .other, + .@"3ds", => false, }; } @@ -2153,6 +2167,8 @@ pub const DynamicLinker = struct { .uefi, .windows, + .@"3ds", + .emscripten, .wasi, @@ -2537,6 +2553,8 @@ pub const DynamicLinker = struct { .uefi, .windows, + .@"3ds", + .emscripten, .wasi, @@ -3044,6 +3062,13 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { .longdouble => return 128, }, + .@"3ds" => switch (c_type) { + .char => return 8, + .short, .ushort => return 16, + .int, .uint, .float, .long, .ulong => return 32, + .longlong, .ulonglong, .double, .longdouble => return 64, + }, + .ps4, .ps5 => switch (c_type) { .char => return 8, .short, .ushort => return 16, diff --git a/src/Compilation.zig b/src/Compilation.zig index f0c4dbf473..db15eee954 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6924,6 +6924,11 @@ pub fn addCCArgs( }, } + switch (target.os.tag) { + .@"3ds" => try argv.append("-D__3DS__"), + else => {}, + } + if (comp.config.link_libc) { if (target.isGnuLibC()) { const target_version = target.os.versionRange().gnuLibCVersion().?; diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 5c683a965a..9d58dbd869 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -228,6 +228,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .serenity => "serenity", .vulkan => "vulkan", + .@"3ds", .opengl, .plan9, .contiki, diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index 3cb867f763..fe64aa7bda 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -48,6 +48,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .arc, .os_tag = .linux, .abi = .gnu }, .{ .cpu_arch = .arc, .os_tag = .linux, .abi = .none }, + .{ .cpu_arch = .arm, .os_tag = .@"3ds", .abi = .eabihf }, .{ .cpu_arch = .arm, .os_tag = .freebsd, .abi = .eabihf }, .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabi }, .{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabihf }, @@ -250,6 +251,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .sparc64, .os_tag = .rtems, .abi = .none }, .{ .cpu_arch = .sparc64, .os_tag = .solaris, .abi = .none }, + .{ .cpu_arch = .thumb, .os_tag = .@"3ds", .abi = .eabihf }, .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabi }, .{ .cpu_arch = .thumb, .os_tag = .freestanding, .abi = .eabihf }, .{ .cpu_arch = .thumb, .os_tag = .linux, .abi = .eabi },