diff --git a/lib/std/Build/Configuration.zig b/lib/std/Build/Configuration.zig index f10bf9055b58d63061dfa3b37ff7954474a35dcf..031d7dc36e9b8456f8ee5609c4a881bd85c37ce0 100644 --- a/lib/std/Build/Configuration.zig +++ b/lib/std/Build/Configuration.zig @@ -2635,6 +2635,7 @@ pub const TargetQuery = struct { opengl, vulkan, tios, + ashetos, default, @@ -2685,6 +2686,7 @@ pub const TargetQuery = struct { .opengl => .opengl, .vulkan => .vulkan, .tios => .tios, + .ashetos => .ashetos, }; } @@ -2735,6 +2737,7 @@ pub const TargetQuery = struct { .opengl => .opengl, .vulkan => .vulkan, .tios => .tios, + .ashetos => .ashetos, .default => null, }; diff --git a/lib/std/Target.zig b/lib/std/Target.zig index a75d23ca4d7530da5aaeda2c3f9c5a2056914391..c12239aef1b1c06c21ebb0061c9c32fea0e12ff1 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -72,6 +72,8 @@ pub const Os = struct { tios, + ashetos, + // LLVM tags deliberately omitted: // - bridgeos // - cheriotrtos @@ -175,6 +177,8 @@ pub const Os = struct { .emscripten, .mesa3d, + + .ashetos, => .none, .contiki, @@ -412,6 +416,8 @@ pub const Os = struct { .emscripten, .mesa3d, + + .ashetos, => .{ .none = {} }, .contiki => .{ @@ -957,6 +963,8 @@ pub const Abi = enum { .vita => .eabihf, .wasi, .emscripten => .musl, + .ashetos => .eabi, + .contiki, .hermit, .illumos, @@ -2321,6 +2329,7 @@ pub fn requiresLibC(target: *const Target) bool { .@"3ds", .tios, .wiiu, + .ashetos, => false, }; } @@ -2489,6 +2498,7 @@ pub const DynamicLinker = struct { .vita, .tios, + .ashetos, => .none, }; } @@ -2910,6 +2920,7 @@ pub const DynamicLinker = struct { .vulkan, .tios, + .ashetos, => none, // 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 { pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { switch (target.os.tag) { - .freestanding, .other => switch (target.cpu.arch) { + .freestanding, + .other, + .ashetos, + => switch (target.cpu.arch) { .msp430, .x86_16, => switch (c_type) { diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index 9dd28b3e37b3cfbfa247dde25368b5b59ed530e2..ad0d709425cfaccd284cd929bc7329604a325213 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -453,9 +453,7 @@ pub fn resolve(options: Options) ResolveError!Config { const pie = b: { switch (options.output_mode) { - .Exe => if (target.os.tag == .fuchsia or - (target.abi.isAndroid() and link_mode == .dynamic)) - { + .Exe => if (target_util.requiresPie(target, link_mode)) { if (options.pie == false) return error.TargetRequiresPie; break :b true; }, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 2e79acc1e3e930b8c437099650329117a61e5428..c485b15ede656e04bdb0908902452f310b5943e8 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -251,6 +251,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .vita, .tios, .wiiu, + .ashetos, => "unknown", }; try llvm_triple.appendSlice(llvm_os); diff --git a/src/target.zig b/src/target.zig index f5589df23b2116959cad4d422fcab4ec44919287..08ac102764c104518d79119251b494ebaf09c5ea 100644 --- a/src/target.zig +++ b/src/target.zig @@ -61,6 +61,12 @@ pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool { }; } +pub fn requiresPie(target: *const std.Target, link_mode: std.lang.LinkMode) bool { + return target.os.tag == .fuchsia or + (target.abi.isAndroid() and link_mode == .dynamic) or + target.os.tag == .ashetos; +} + /// This function returns whether non-pic code is completely invalid on the given target. pub fn requiresPic(target: *const std.Target, linking_libc: bool) bool { return ((target.os.tag == .windows or target.os.tag == .uefi) and (target.cpu.arch == .aarch64 or target.cpu.arch == .x86_64)) or