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 {
26352635 opengl,
26362636 vulkan,
26372637 tios,
2638 ashetos,
26382639
26392640 default,
26402641
......@@ -2685,6 +2686,7 @@ pub const TargetQuery = struct {
26852686 .opengl => .opengl,
26862687 .vulkan => .vulkan,
26872688 .tios => .tios,
2689 .ashetos => .ashetos,
26882690 };
26892691 }
26902692
......@@ -2735,6 +2737,7 @@ pub const TargetQuery = struct {
27352737 .opengl => .opengl,
27362738 .vulkan => .vulkan,
27372739 .tios => .tios,
2740 .ashetos => .ashetos,
27382741
27392742 .default => null,
27402743 };
lib/std/Target.zig+15-1
......@@ -72,6 +72,8 @@ pub const Os = struct {
7272
7373 tios,
7474
75 ashetos,
76
7577 // LLVM tags deliberately omitted:
7678 // - bridgeos
7779 // - cheriotrtos
......@@ -175,6 +177,8 @@ pub const Os = struct {
175177 .emscripten,
176178
177179 .mesa3d,
180
181 .ashetos,
178182 => .none,
179183
180184 .contiki,
......@@ -412,6 +416,8 @@ pub const Os = struct {
412416 .emscripten,
413417
414418 .mesa3d,
419
420 .ashetos,
415421 => .{ .none = {} },
416422
417423 .contiki => .{
......@@ -957,6 +963,8 @@ pub const Abi = enum {
957963 .vita => .eabihf,
958964 .wasi, .emscripten => .musl,
959965
966 .ashetos => .eabi,
967
960968 .contiki,
961969 .hermit,
962970 .illumos,
......@@ -2321,6 +2329,7 @@ pub fn requiresLibC(target: *const Target) bool {
23212329 .@"3ds",
23222330 .tios,
23232331 .wiiu,
2332 .ashetos,
23242333 => false,
23252334 };
23262335}
......@@ -2489,6 +2498,7 @@ pub const DynamicLinker = struct {
24892498 .vita,
24902499
24912500 .tios,
2501 .ashetos,
24922502 => .none,
24932503 };
24942504 }
......@@ -2910,6 +2920,7 @@ pub const DynamicLinker = struct {
29102920 .vulkan,
29112921
29122922 .tios,
2923 .ashetos,
29132924 => none,
29142925
29152926 // 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 {
31743185
31753186pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
31763187 switch (target.os.tag) {
3177 .freestanding, .other => switch (target.cpu.arch) {
3188 .freestanding,
3189 .other,
3190 .ashetos,
3191 => switch (target.cpu.arch) {
31783192 .msp430,
31793193 .x86_16,
31803194 => switch (c_type) {
src/Compilation/Config.zig+1-3
......@@ -453,9 +453,7 @@ pub fn resolve(options: Options) ResolveError!Config {
453453
454454 const pie = b: {
455455 switch (options.output_mode) {
456 .Exe => if (target.os.tag == .fuchsia or
457 (target.abi.isAndroid() and link_mode == .dynamic))
458 {
456 .Exe => if (target_util.requiresPie(target, link_mode)) {
459457 if (options.pie == false) return error.TargetRequiresPie;
460458 break :b true;
461459 },
src/codegen/llvm.zig+1
......@@ -251,6 +251,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8
251251 .vita,
252252 .tios,
253253 .wiiu,
254 .ashetos,
254255 => "unknown",
255256 };
256257 try llvm_triple.appendSlice(llvm_os);
src/target.zig+6
......@@ -61,6 +61,12 @@ pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool {
6161 };
6262}
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
6470/// This function returns whether non-pic code is completely invalid on the given target.
6571pub fn requiresPic(target: *const std.Target, linking_libc: bool) bool {
6672 return ((target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64)) or