Skip to content

Commit 097f1e5

Browse files
committed
std.Target: add vita os
1 parent f97c91d commit 097f1e5

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

lib/std/Target.zig

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub const Os = struct {
5353
ps3,
5454
ps4,
5555
ps5,
56+
vita,
5657

5758
emscripten,
5859
wasi,
@@ -203,6 +204,8 @@ pub const Os = struct {
203204
.opencl,
204205
.opengl,
205206
.vulkan,
207+
208+
.vita,
206209
=> .semver,
207210

208211
.hurd => .hurd,
@@ -649,6 +652,13 @@ pub const Os = struct {
649652
.max = .{ .major = 1, .minor = 4, .patch = 313 },
650653
},
651654
},
655+
.vita => .{
656+
.semver = .{
657+
// 1.3 is the first public release
658+
.min = .{ .major = 1, .minor = 3, .patch = 0 },
659+
.max = .{ .major = 3, .minor = 60, .patch = 0 },
660+
},
661+
},
652662
};
653663
}
654664
};
@@ -725,13 +735,14 @@ pub const Os = struct {
725735
.freestanding,
726736
.fuchsia,
727737
.ps3,
738+
.ps4,
739+
.ps5,
740+
.vita,
728741
.zos,
729742
.rtems,
730743
.cuda,
731744
.nvcl,
732745
.amdhsa,
733-
.ps4,
734-
.ps5,
735746
.mesa3d,
736747
.contiki,
737748
.amdpal,
@@ -913,6 +924,7 @@ pub const Abi = enum {
913924
.windows => .gnu,
914925
.uefi => .msvc,
915926
.wasi, .emscripten => .musl,
927+
.vita => .eabihf,
916928

917929
.contiki,
918930
.fuchsia,
@@ -2164,6 +2176,7 @@ pub const DynamicLinker = struct {
21642176
.ps3,
21652177
.ps4,
21662178
.ps5,
2179+
.vita,
21672180
=> .none,
21682181
};
21692182
}
@@ -2544,6 +2557,8 @@ pub const DynamicLinker = struct {
25442557
.opencl,
25452558
.opengl,
25462559
.vulkan,
2560+
2561+
.vita,
25472562
=> none,
25482563

25492564
// TODO go over each item in this list and either move it to the above list, or
@@ -2747,7 +2762,7 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {
27472762

27482763
pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
27492764
switch (target.os.tag) {
2750-
.freestanding, .other => switch (target.cpu.arch) {
2765+
.freestanding, .other, .vita, => switch (target.cpu.arch) {
27512766
.msp430 => switch (c_type) {
27522767
.char => return 8,
27532768
.short, .ushort, .int, .uint => return 16,

src/Compilation.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6350,6 +6350,11 @@ pub fn addCCArgs(
63506350
// doesn't matter which one gets overridden.
63516351
argv.appendAssumeCapacity("-Wno-overriding-option");
63526352
},
6353+
.vita => {
6354+
// LLVM doesn't support this target, so we
6355+
// have to add this manually
6356+
try argv.append("-D__vita__");
6357+
},
63536358
else => {},
63546359
}
63556360

src/codegen/llvm.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
197197
.freebsd => "freebsd",
198198
.fuchsia => "fuchsia",
199199
.linux => "linux",
200-
.ps3 => "lv2",
201200
.netbsd => "netbsd",
202201
.openbsd => "openbsd",
203202
.solaris, .illumos => "solaris",
@@ -210,8 +209,10 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
210209
.nvcl => "nvcl",
211210
.amdhsa => "amdhsa",
212211
.opencl => "unknown", // https://llvm.org/docs/SPIRVUsage.html#target-triples
212+
.ps3 => "lv2",
213213
.ps4 => "ps4",
214214
.ps5 => "ps5",
215+
.vita => "unknown", // LLVM doesn't know about this target
215216
.mesa3d => "mesa3d",
216217
.amdpal => "amdpal",
217218
.hermit => "hermit",

test/llvm_targets.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const targets = [_]std.Target.Query{
6767
.{ .cpu_arch = .arm, .os_tag = .openbsd, .abi = .eabihf },
6868
.{ .cpu_arch = .arm, .os_tag = .rtems, .abi = .eabi },
6969
.{ .cpu_arch = .arm, .os_tag = .rtems, .abi = .eabihf },
70+
.{ .cpu_arch = .arm, .os_tag = .vita, .abi = .eabihf },
7071
// .{ .cpu_arch = .arm, .os_tag = .uefi, .abi = .eabi },
7172
// .{ .cpu_arch = .arm, .os_tag = .uefi, .abi = .eabihf },
7273

@@ -261,6 +262,7 @@ const targets = [_]std.Target.Query{
261262
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .gnu },
262263
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .itanium },
263264
.{ .cpu_arch = .thumb, .os_tag = .windows, .abi = .msvc },
265+
.{ .cpu_arch = .thumb, .os_tag = .vita, .abi = .eabihf },
264266

265267
.{ .cpu_arch = .thumbeb, .os_tag = .freestanding, .abi = .eabi },
266268
.{ .cpu_arch = .thumbeb, .os_tag = .freestanding, .abi = .eabihf },

0 commit comments

Comments
 (0)