authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2026-07-07 15:19:20+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-07-07 15:19:20+02:00
log8219c86100b9679255ad06bf6a743716bef26102
tree9462d2c68a8c73c2c0fb87fdd87a11b5933c647e
parent3210dc4b006cd8718e5fee5530ad4383b0230959

std.Target: add ashetos tag (#35954)

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35954

5 files changed, 26 insertions(+), 4 deletions(-)

lib/std/Build/Configuration.zig+3
...@@ -2635,6 +2635,7 @@ pub const TargetQuery = struct {...@@ -2635,6 +2635,7 @@ pub const TargetQuery = struct {
2635 opengl,2635 opengl,
2636 vulkan,2636 vulkan,
2637 tios,2637 tios,
2638 ashetos,
26382639
2639 default,2640 default,
26402641
...@@ -2685,6 +2686,7 @@ pub const TargetQuery = struct {...@@ -2685,6 +2686,7 @@ pub const TargetQuery = struct {
2685 .opengl => .opengl,2686 .opengl => .opengl,
2686 .vulkan => .vulkan,2687 .vulkan => .vulkan,
2687 .tios => .tios,2688 .tios => .tios,
2689 .ashetos => .ashetos,
2688 };2690 };
2689 }2691 }
26902692
...@@ -2735,6 +2737,7 @@ pub const TargetQuery = struct {...@@ -2735,6 +2737,7 @@ pub const TargetQuery = struct {
2735 .opengl => .opengl,2737 .opengl => .opengl,
2736 .vulkan => .vulkan,2738 .vulkan => .vulkan,
2737 .tios => .tios,2739 .tios => .tios,
2740 .ashetos => .ashetos,
27382741
2739 .default => null,2742 .default => null,
2740 };2743 };
lib/std/Target.zig+15-1
...@@ -72,6 +72,8 @@ pub const Os = struct {...@@ -72,6 +72,8 @@ pub const Os = struct {
7272
73 tios,73 tios,
7474
75 ashetos,
76
75 // LLVM tags deliberately omitted:77 // LLVM tags deliberately omitted:
76 // - bridgeos78 // - bridgeos
77 // - cheriotrtos79 // - cheriotrtos
...@@ -175,6 +177,8 @@ pub const Os = struct {...@@ -175,6 +177,8 @@ pub const Os = struct {
175 .emscripten,177 .emscripten,
176178
177 .mesa3d,179 .mesa3d,
180
181 .ashetos,
178 => .none,182 => .none,
179183
180 .contiki,184 .contiki,
...@@ -412,6 +416,8 @@ pub const Os = struct {...@@ -412,6 +416,8 @@ pub const Os = struct {
412 .emscripten,416 .emscripten,
413417
414 .mesa3d,418 .mesa3d,
419
420 .ashetos,
415 => .{ .none = {} },421 => .{ .none = {} },
416422
417 .contiki => .{423 .contiki => .{
...@@ -957,6 +963,8 @@ pub const Abi = enum {...@@ -957,6 +963,8 @@ pub const Abi = enum {
957 .vita => .eabihf,963 .vita => .eabihf,
958 .wasi, .emscripten => .musl,964 .wasi, .emscripten => .musl,
959965
966 .ashetos => .eabi,
967
960 .contiki,968 .contiki,
961 .hermit,969 .hermit,
962 .illumos,970 .illumos,
...@@ -2321,6 +2329,7 @@ pub fn requiresLibC(target: *const Target) bool {...@@ -2321,6 +2329,7 @@ pub fn requiresLibC(target: *const Target) bool {
2321 .@"3ds",2329 .@"3ds",
2322 .tios,2330 .tios,
2323 .wiiu,2331 .wiiu,
2332 .ashetos,
2324 => false,2333 => false,
2325 };2334 };
2326}2335}
...@@ -2489,6 +2498,7 @@ pub const DynamicLinker = struct {...@@ -2489,6 +2498,7 @@ pub const DynamicLinker = struct {
2489 .vita,2498 .vita,
24902499
2491 .tios,2500 .tios,
2501 .ashetos,
2492 => .none,2502 => .none,
2493 };2503 };
2494 }2504 }
...@@ -2910,6 +2920,7 @@ pub const DynamicLinker = struct {...@@ -2910,6 +2920,7 @@ pub const DynamicLinker = struct {
2910 .vulkan,2920 .vulkan,
29112921
2912 .tios,2922 .tios,
2923 .ashetos,
2913 => none,2924 => none,
29142925
2915 // TODO go over each item in this list and either move it to the above list, or2926 // TODO go over each item in this list and either move it to the above list, or
...@@ -3174,7 +3185,10 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {...@@ -3174,7 +3185,10 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {
31743185
3175pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {3186pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3176 switch (target.os.tag) {3187 switch (target.os.tag) {
3177 .freestanding, .other => switch (target.cpu.arch) {3188 .freestanding,
3189 .other,
3190 .ashetos,
3191 => switch (target.cpu.arch) {
3178 .msp430,3192 .msp430,
3179 .x86_16,3193 .x86_16,
3180 => switch (c_type) {3194 => switch (c_type) {
src/Compilation/Config.zig+1-3
...@@ -453,9 +453,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -453,9 +453,7 @@ pub fn resolve(options: Options) ResolveError!Config {
453453
454 const pie = b: {454 const pie = b: {
455 switch (options.output_mode) {455 switch (options.output_mode) {
456 .Exe => if (target.os.tag == .fuchsia or456 .Exe => if (target_util.requiresPie(target, link_mode)) {
457 (target.abi.isAndroid() and link_mode == .dynamic))
458 {
459 if (options.pie == false) return error.TargetRequiresPie;457 if (options.pie == false) return error.TargetRequiresPie;
460 break :b true;458 break :b true;
461 },459 },
src/codegen/llvm.zig+1
...@@ -251,6 +251,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8...@@ -251,6 +251,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
251 .vita,251 .vita,
252 .tios,252 .tios,
253 .wiiu,253 .wiiu,
254 .ashetos,
254 => "unknown",255 => "unknown",
255 };256 };
256 try llvm_triple.appendSlice(llvm_os);257 try llvm_triple.appendSlice(llvm_os);
src/target.zig+6
...@@ -61,6 +61,12 @@ pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool {...@@ -61,6 +61,12 @@ pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool {
61 };61 };
62}62}
6363
64pub 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;
68}
69
64/// This function returns whether non-pic code is completely invalid on the given target.70/// This function returns whether non-pic code is completely invalid on the given target.
65pub fn requiresPic(target: *const std.Target, linking_libc: bool) bool {71pub fn requiresPic(target: *const std.Target, linking_libc: bool) bool {
66 return ((target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64)) or72 return ((target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64)) or