| author | |
| committer | |
| log | 481b7bf3f095488a89e20d88ada092529bc6e6f8 |
| tree | 9e4dde982be4327fb18d156d7b3540c8d03ce658 |
| parent | e62352611faf3056b989cc1edaa4aedaa74f326e |
| signature |
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:
* It's not immediately obvious to a reader whether target.isDarwin() means the
same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.48 files changed, 149 insertions(+), 178 deletions(-)
build.zig+1-1| ... | @@ -742,7 +742,7 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -742,7 +742,7 @@ fn addCmakeCfgOptionsToExe( |
| 742 | const mod = exe.root_module; | 742 | const mod = exe.root_module; |
| 743 | const target = mod.resolved_target.?.result; | 743 | const target = mod.resolved_target.?.result; |
| 744 | 744 | ||
| 745 | if (target.isDarwin()) { | 745 | if (target.os.tag.isDarwin()) { |
| 746 | // useful for package maintainers | 746 | // useful for package maintainers |
| 747 | exe.headerpad_max_install_names = true; | 747 | exe.headerpad_max_install_names = true; |
| 748 | } | 748 | } |
lib/compiler/aro/aro/Compilation.zig+2-2| ... | @@ -308,7 +308,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void { | ... | @@ -308,7 +308,7 @@ fn generateSystemDefines(comp: *Compilation, w: anytype) !void { |
| 308 | ), | 308 | ), |
| 309 | else => {}, | 309 | else => {}, |
| 310 | } | 310 | } |
| 311 | if (comp.target.isAndroid()) { | 311 | if (comp.target.abi.isAndroid()) { |
| 312 | try w.writeAll("#define __ANDROID__ 1\n"); | 312 | try w.writeAll("#define __ANDROID__ 1\n"); |
| 313 | } | 313 | } |
| 314 | 314 | ||
| ... | @@ -734,7 +734,7 @@ pub fn float80Type(comp: *const Compilation) ?Type { | ... | @@ -734,7 +734,7 @@ pub fn float80Type(comp: *const Compilation) ?Type { |
| 734 | 734 | ||
| 735 | /// Smallest integer type with at least N bits | 735 | /// Smallest integer type with at least N bits |
| 736 | pub fn intLeastN(comp: *const Compilation, bits: usize, signedness: std.builtin.Signedness) Type { | 736 | pub fn intLeastN(comp: *const Compilation, bits: usize, signedness: std.builtin.Signedness) Type { |
| 737 | if (bits == 64 and (comp.target.isDarwin() or comp.target.isWasm())) { | 737 | if (bits == 64 and (comp.target.os.tag.isDarwin() or comp.target.cpu.arch.isWasm())) { |
| 738 | // WebAssembly and Darwin use `long long` for `int_least64_t` and `int_fast64_t`. | 738 | // WebAssembly and Darwin use `long long` for `int_least64_t` and `int_fast64_t`. |
| 739 | return .{ .specifier = if (signedness == .signed) .long_long else .ulong_long }; | 739 | return .{ .specifier = if (signedness == .signed) .long_long else .ulong_long }; |
| 740 | } | 740 | } |
lib/compiler/aro/aro/Driver/GCCDetector.zig+1-1| ... | @@ -183,7 +183,7 @@ fn collectLibDirsAndTriples( | ... | @@ -183,7 +183,7 @@ fn collectLibDirsAndTriples( |
| 183 | // TODO | 183 | // TODO |
| 184 | return; | 184 | return; |
| 185 | } | 185 | } |
| 186 | if (target.isAndroid()) { | 186 | if (target.abi.isAndroid()) { |
| 187 | const AArch64AndroidTriples: [1][]const u8 = .{"aarch64-linux-android"}; | 187 | const AArch64AndroidTriples: [1][]const u8 = .{"aarch64-linux-android"}; |
| 188 | const ARMAndroidTriples: [1][]const u8 = .{"arm-linux-androideabi"}; | 188 | const ARMAndroidTriples: [1][]const u8 = .{"arm-linux-androideabi"}; |
| 189 | const MIPSELAndroidTriples: [1][]const u8 = .{"mipsel-linux-android"}; | 189 | const MIPSELAndroidTriples: [1][]const u8 = .{"mipsel-linux-android"}; |
lib/compiler/aro/aro/Toolchain.zig+7-7| ... | @@ -161,7 +161,7 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { | ... | @@ -161,7 +161,7 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { |
| 161 | } else { | 161 | } else { |
| 162 | var linker_name = try std.ArrayList(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker | 162 | var linker_name = try std.ArrayList(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker |
| 163 | defer linker_name.deinit(); | 163 | defer linker_name.deinit(); |
| 164 | if (tc.getTarget().isDarwin()) { | 164 | if (tc.getTarget().os.tag.isDarwin()) { |
| 165 | linker_name.appendSliceAssumeCapacity("ld64."); | 165 | linker_name.appendSliceAssumeCapacity("ld64."); |
| 166 | } else { | 166 | } else { |
| 167 | linker_name.appendSliceAssumeCapacity("ld."); | 167 | linker_name.appendSliceAssumeCapacity("ld."); |
| ... | @@ -343,7 +343,7 @@ pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.ArrayList([]const u8)) !void { | ... | @@ -343,7 +343,7 @@ pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.ArrayList([]const u8)) !void { |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind { | 345 | fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind { |
| 346 | if (tc.getTarget().isAndroid()) { | 346 | if (tc.getTarget().abi.isAndroid()) { |
| 347 | return .compiler_rt; | 347 | return .compiler_rt; |
| 348 | } | 348 | } |
| 349 | return .libgcc; | 349 | return .libgcc; |
| ... | @@ -369,7 +369,7 @@ pub fn getCompilerRt(tc: *const Toolchain, component: []const u8, file_kind: Fil | ... | @@ -369,7 +369,7 @@ pub fn getCompilerRt(tc: *const Toolchain, component: []const u8, file_kind: Fil |
| 369 | 369 | ||
| 370 | fn getLibGCCKind(tc: *const Toolchain) LibGCCKind { | 370 | fn getLibGCCKind(tc: *const Toolchain) LibGCCKind { |
| 371 | const target = tc.getTarget(); | 371 | const target = tc.getTarget(); |
| 372 | if (tc.driver.static_libgcc or tc.driver.static or tc.driver.static_pie or target.isAndroid()) { | 372 | if (tc.driver.static_libgcc or tc.driver.static or tc.driver.static_pie or target.abi.isAndroid()) { |
| 373 | return .static; | 373 | return .static; |
| 374 | } | 374 | } |
| 375 | if (tc.driver.shared_libgcc) { | 375 | if (tc.driver.shared_libgcc) { |
| ... | @@ -384,7 +384,7 @@ fn getUnwindLibKind(tc: *const Toolchain) !UnwindLibKind { | ... | @@ -384,7 +384,7 @@ fn getUnwindLibKind(tc: *const Toolchain) !UnwindLibKind { |
| 384 | switch (tc.getRuntimeLibKind()) { | 384 | switch (tc.getRuntimeLibKind()) { |
| 385 | .compiler_rt => { | 385 | .compiler_rt => { |
| 386 | const target = tc.getTarget(); | 386 | const target = tc.getTarget(); |
| 387 | if (target.isAndroid() or target.os.tag == .aix) { | 387 | if (target.abi.isAndroid() or target.os.tag == .aix) { |
| 388 | return .compiler_rt; | 388 | return .compiler_rt; |
| 389 | } else { | 389 | } else { |
| 390 | return .none; | 390 | return .none; |
| ... | @@ -417,14 +417,14 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { | ... | @@ -417,14 +417,14 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { |
| 417 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | 417 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { |
| 418 | const unw = try tc.getUnwindLibKind(); | 418 | const unw = try tc.getUnwindLibKind(); |
| 419 | const target = tc.getTarget(); | 419 | const target = tc.getTarget(); |
| 420 | if ((target.isAndroid() and unw == .libgcc) or | 420 | if ((target.abi.isAndroid() and unw == .libgcc) or |
| 421 | target.os.tag == .elfiamcu or | 421 | target.os.tag == .elfiamcu or |
| 422 | target.ofmt == .wasm or | 422 | target.ofmt == .wasm or |
| 423 | target_util.isWindowsMSVCEnvironment(target) or | 423 | target_util.isWindowsMSVCEnvironment(target) or |
| 424 | unw == .none) return; | 424 | unw == .none) return; |
| 425 | 425 | ||
| 426 | const lgk = tc.getLibGCCKind(); | 426 | const lgk = tc.getLibGCCKind(); |
| 427 | const as_needed = lgk == .unspecified and !target.isAndroid() and !target_util.isCygwinMinGW(target) and target.os.tag != .aix; | 427 | const as_needed = lgk == .unspecified and !target.abi.isAndroid() and !target_util.isCygwinMinGW(target) and target.os.tag != .aix; |
| 428 | if (as_needed) { | 428 | if (as_needed) { |
| 429 | try argv.append(getAsNeededOption(target.os.tag == .solaris, true)); | 429 | try argv.append(getAsNeededOption(target.os.tag == .solaris, true)); |
| 430 | } | 430 | } |
| ... | @@ -483,7 +483,7 @@ pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !v | ... | @@ -483,7 +483,7 @@ pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !v |
| 483 | }, | 483 | }, |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | if (target.isAndroid() and !tc.driver.static and !tc.driver.static_pie) { | 486 | if (target.abi.isAndroid() and !tc.driver.static and !tc.driver.static_pie) { |
| 487 | try argv.append("-ldl"); | 487 | try argv.append("-ldl"); |
| 488 | } | 488 | } |
| 489 | } | 489 | } |
lib/compiler/aro/aro/Type.zig+1-1| ... | @@ -1102,7 +1102,7 @@ pub fn alignof(ty: Type, comp: *const Compilation) u29 { | ... | @@ -1102,7 +1102,7 @@ pub fn alignof(ty: Type, comp: *const Compilation) u29 { |
| 1102 | .double => comp.target.cTypeAlignment(.double), | 1102 | .double => comp.target.cTypeAlignment(.double), |
| 1103 | .long_double => comp.target.cTypeAlignment(.longdouble), | 1103 | .long_double => comp.target.cTypeAlignment(.longdouble), |
| 1104 | 1104 | ||
| 1105 | .int128, .uint128 => if (comp.target.cpu.arch == .s390x and comp.target.os.tag == .linux and comp.target.isGnu()) 8 else 16, | 1105 | .int128, .uint128 => if (comp.target.cpu.arch == .s390x and comp.target.os.tag == .linux and comp.target.abi.isGnu()) 8 else 16, |
| 1106 | .fp16, .float16 => 2, | 1106 | .fp16, .float16 => 2, |
| 1107 | 1107 | ||
| 1108 | .float128 => 16, | 1108 | .float128 => 16, |
lib/compiler/aro/aro/target.zig+8-9| ... | @@ -117,8 +117,8 @@ pub fn int64Type(target: std.Target) Type { | ... | @@ -117,8 +117,8 @@ pub fn int64Type(target: std.Target) Type { |
| 117 | 117 | ||
| 118 | .sparc64 => return intMaxType(target), | 118 | .sparc64 => return intMaxType(target), |
| 119 | 119 | ||
| 120 | .x86, .x86_64 => if (!target.isDarwin()) return intMaxType(target), | 120 | .x86, .x86_64 => if (!target.os.tag.isDarwin()) return intMaxType(target), |
| 121 | .aarch64, .aarch64_be => if (!target.isDarwin() and target.os.tag != .openbsd and target.os.tag != .windows) return .{ .specifier = .long }, | 121 | .aarch64, .aarch64_be => if (!target.os.tag.isDarwin() and target.os.tag != .openbsd and target.os.tag != .windows) return .{ .specifier = .long }, |
| 122 | else => {}, | 122 | else => {}, |
| 123 | } | 123 | } |
| 124 | return .{ .specifier = .long_long }; | 124 | return .{ .specifier = .long_long }; |
| ... | @@ -144,7 +144,7 @@ pub fn defaultFunctionAlignment(target: std.Target) u8 { | ... | @@ -144,7 +144,7 @@ pub fn defaultFunctionAlignment(target: std.Target) u8 { |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | pub fn isTlsSupported(target: std.Target) bool { | 146 | pub fn isTlsSupported(target: std.Target) bool { |
| 147 | if (target.isDarwin()) { | 147 | if (target.os.tag.isDarwin()) { |
| 148 | var supported = false; | 148 | var supported = false; |
| 149 | switch (target.os.tag) { | 149 | switch (target.os.tag) { |
| 150 | .macos => supported = !(target.os.isAtLeast(.macos, .{ .major = 10, .minor = 7, .patch = 0 }) orelse false), | 150 | .macos => supported = !(target.os.isAtLeast(.macos, .{ .major = 10, .minor = 7, .patch = 0 }) orelse false), |
| ... | @@ -199,7 +199,7 @@ pub fn minZeroWidthBitfieldAlignment(target: std.Target) ?u29 { | ... | @@ -199,7 +199,7 @@ pub fn minZeroWidthBitfieldAlignment(target: std.Target) ?u29 { |
| 199 | pub fn unnamedFieldAffectsAlignment(target: std.Target) bool { | 199 | pub fn unnamedFieldAffectsAlignment(target: std.Target) bool { |
| 200 | switch (target.cpu.arch) { | 200 | switch (target.cpu.arch) { |
| 201 | .aarch64 => { | 201 | .aarch64 => { |
| 202 | if (target.isDarwin() or target.os.tag == .windows) return false; | 202 | if (target.os.tag.isDarwin() or target.os.tag == .windows) return false; |
| 203 | return true; | 203 | return true; |
| 204 | }, | 204 | }, |
| 205 | .armeb => { | 205 | .armeb => { |
| ... | @@ -229,7 +229,7 @@ pub fn packAllEnums(target: std.Target) bool { | ... | @@ -229,7 +229,7 @@ pub fn packAllEnums(target: std.Target) bool { |
| 229 | pub fn defaultAlignment(target: std.Target) u29 { | 229 | pub fn defaultAlignment(target: std.Target) u29 { |
| 230 | switch (target.cpu.arch) { | 230 | switch (target.cpu.arch) { |
| 231 | .avr => return 1, | 231 | .avr => return 1, |
| 232 | .arm => if (target.isAndroid() or target.os.tag == .ios) return 16 else return 8, | 232 | .arm => if (target.abi.isAndroid() or target.os.tag == .ios) return 16 else return 8, |
| 233 | .sparc => if (std.Target.sparc.featureSetHas(target.cpu.features, .v9)) return 16 else return 8, | 233 | .sparc => if (std.Target.sparc.featureSetHas(target.cpu.features, .v9)) return 16 else return 8, |
| 234 | .mips, .mipsel => switch (target.abi) { | 234 | .mips, .mipsel => switch (target.abi) { |
| 235 | .none, .gnuabi64 => return 16, | 235 | .none, .gnuabi64 => return 16, |
| ... | @@ -242,9 +242,8 @@ pub fn defaultAlignment(target: std.Target) u29 { | ... | @@ -242,9 +242,8 @@ pub fn defaultAlignment(target: std.Target) u29 { |
| 242 | pub fn systemCompiler(target: std.Target) LangOpts.Compiler { | 242 | pub fn systemCompiler(target: std.Target) LangOpts.Compiler { |
| 243 | // Android is linux but not gcc, so these checks go first | 243 | // Android is linux but not gcc, so these checks go first |
| 244 | // the rest for documentation as fn returns .clang | 244 | // the rest for documentation as fn returns .clang |
| 245 | if (target.isDarwin() or | 245 | if (target.abi.isAndroid() or |
| 246 | target.isAndroid() or | 246 | target.os.tag.isBSD() or |
| 247 | target.isBSD() or | ||
| 248 | target.os.tag == .fuchsia or | 247 | target.os.tag == .fuchsia or |
| 249 | target.os.tag == .solaris or | 248 | target.os.tag == .solaris or |
| 250 | target.os.tag == .haiku or | 249 | target.os.tag == .haiku or |
| ... | @@ -268,7 +267,7 @@ pub fn systemCompiler(target: std.Target) LangOpts.Compiler { | ... | @@ -268,7 +267,7 @@ pub fn systemCompiler(target: std.Target) LangOpts.Compiler { |
| 268 | 267 | ||
| 269 | pub fn hasFloat128(target: std.Target) bool { | 268 | pub fn hasFloat128(target: std.Target) bool { |
| 270 | if (target.cpu.arch.isWasm()) return true; | 269 | if (target.cpu.arch.isWasm()) return true; |
| 271 | if (target.isDarwin()) return false; | 270 | if (target.os.tag.isDarwin()) return false; |
| 272 | if (target.cpu.arch.isPowerPC()) return std.Target.powerpc.featureSetHas(target.cpu.features, .float128); | 271 | if (target.cpu.arch.isPowerPC()) return std.Target.powerpc.featureSetHas(target.cpu.features, .float128); |
| 273 | return switch (target.os.tag) { | 272 | return switch (target.os.tag) { |
| 274 | .dragonfly, | 273 | .dragonfly, |
lib/compiler/aro/aro/toolchains/Linux.zig+7-7| ... | @@ -27,7 +27,7 @@ pub fn discover(self: *Linux, tc: *Toolchain) !void { | ... | @@ -27,7 +27,7 @@ pub fn discover(self: *Linux, tc: *Toolchain) !void { |
| 27 | fn buildExtraOpts(self: *Linux, tc: *const Toolchain) !void { | 27 | fn buildExtraOpts(self: *Linux, tc: *const Toolchain) !void { |
| 28 | const gpa = tc.driver.comp.gpa; | 28 | const gpa = tc.driver.comp.gpa; |
| 29 | const target = tc.getTarget(); | 29 | const target = tc.getTarget(); |
| 30 | const is_android = target.isAndroid(); | 30 | const is_android = target.abi.isAndroid(); |
| 31 | if (self.distro.isAlpine() or is_android) { | 31 | if (self.distro.isAlpine() or is_android) { |
| 32 | try self.extra_opts.ensureUnusedCapacity(gpa, 2); | 32 | try self.extra_opts.ensureUnusedCapacity(gpa, 2); |
| 33 | self.extra_opts.appendAssumeCapacity("-z"); | 33 | self.extra_opts.appendAssumeCapacity("-z"); |
| ... | @@ -113,7 +113,7 @@ fn findPaths(self: *Linux, tc: *Toolchain) !void { | ... | @@ -113,7 +113,7 @@ fn findPaths(self: *Linux, tc: *Toolchain) !void { |
| 113 | try tc.addPathIfExists(&.{ sysroot, "/lib", multiarch_triple }, .file); | 113 | try tc.addPathIfExists(&.{ sysroot, "/lib", multiarch_triple }, .file); |
| 114 | try tc.addPathIfExists(&.{ sysroot, "/lib", "..", os_lib_dir }, .file); | 114 | try tc.addPathIfExists(&.{ sysroot, "/lib", "..", os_lib_dir }, .file); |
| 115 | 115 | ||
| 116 | if (target.isAndroid()) { | 116 | if (target.abi.isAndroid()) { |
| 117 | // TODO | 117 | // TODO |
| 118 | } | 118 | } |
| 119 | try tc.addPathIfExists(&.{ sysroot, "/usr", "lib", multiarch_triple }, .file); | 119 | try tc.addPathIfExists(&.{ sysroot, "/usr", "lib", multiarch_triple }, .file); |
| ... | @@ -156,7 +156,7 @@ fn getStatic(self: *const Linux, d: *const Driver) bool { | ... | @@ -156,7 +156,7 @@ fn getStatic(self: *const Linux, d: *const Driver) bool { |
| 156 | 156 | ||
| 157 | pub fn getDefaultLinker(self: *const Linux, target: std.Target) []const u8 { | 157 | pub fn getDefaultLinker(self: *const Linux, target: std.Target) []const u8 { |
| 158 | _ = self; | 158 | _ = self; |
| 159 | if (target.isAndroid()) { | 159 | if (target.abi.isAndroid()) { |
| 160 | return "ld.lld"; | 160 | return "ld.lld"; |
| 161 | } | 161 | } |
| 162 | return "ld"; | 162 | return "ld"; |
| ... | @@ -169,7 +169,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra | ... | @@ -169,7 +169,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra |
| 169 | const is_pie = self.getPIE(d); | 169 | const is_pie = self.getPIE(d); |
| 170 | const is_static_pie = try self.getStaticPIE(d); | 170 | const is_static_pie = try self.getStaticPIE(d); |
| 171 | const is_static = self.getStatic(d); | 171 | const is_static = self.getStatic(d); |
| 172 | const is_android = target.isAndroid(); | 172 | const is_android = target.abi.isAndroid(); |
| 173 | const is_iamcu = target.os.tag == .elfiamcu; | 173 | const is_iamcu = target.os.tag == .elfiamcu; |
| 174 | const is_ve = target.cpu.arch == .ve; | 174 | const is_ve = target.cpu.arch == .ve; |
| 175 | const has_crt_begin_end_files = target.abi != .none; // TODO: clang checks for MIPS vendor | 175 | const has_crt_begin_end_files = target.abi != .none; // TODO: clang checks for MIPS vendor |
| ... | @@ -326,7 +326,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra | ... | @@ -326,7 +326,7 @@ pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.Arra |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | fn getMultiarchTriple(target: std.Target) ?[]const u8 { | 328 | fn getMultiarchTriple(target: std.Target) ?[]const u8 { |
| 329 | const is_android = target.isAndroid(); | 329 | const is_android = target.abi.isAndroid(); |
| 330 | const is_mips_r6 = std.Target.mips.featureSetHas(target.cpu.features, .mips32r6); | 330 | const is_mips_r6 = std.Target.mips.featureSetHas(target.cpu.features, .mips32r6); |
| 331 | return switch (target.cpu.arch) { | 331 | return switch (target.cpu.arch) { |
| 332 | .arm, .thumb => if (is_android) "arm-linux-androideabi" else if (target.abi == .gnueabihf) "arm-linux-gnueabihf" else "arm-linux-gnueabi", | 332 | .arm, .thumb => if (is_android) "arm-linux-androideabi" else if (target.abi == .gnueabihf) "arm-linux-gnueabihf" else "arm-linux-gnueabi", |
| ... | @@ -380,7 +380,7 @@ pub fn defineSystemIncludes(self: *const Linux, tc: *const Toolchain) !void { | ... | @@ -380,7 +380,7 @@ pub fn defineSystemIncludes(self: *const Linux, tc: *const Toolchain) !void { |
| 380 | 380 | ||
| 381 | // musl prefers /usr/include before builtin includes, so musl targets will add builtins | 381 | // musl prefers /usr/include before builtin includes, so musl targets will add builtins |
| 382 | // at the end of this function (unless disabled with nostdlibinc) | 382 | // at the end of this function (unless disabled with nostdlibinc) |
| 383 | if (!tc.driver.nobuiltininc and (!target.isMusl() or tc.driver.nostdlibinc)) { | 383 | if (!tc.driver.nobuiltininc and (!target.abi.isMusl() or tc.driver.nostdlibinc)) { |
| 384 | try comp.addBuiltinIncludeDir(tc.driver.aro_name); | 384 | try comp.addBuiltinIncludeDir(tc.driver.aro_name); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| ... | @@ -411,7 +411,7 @@ pub fn defineSystemIncludes(self: *const Linux, tc: *const Toolchain) !void { | ... | @@ -411,7 +411,7 @@ pub fn defineSystemIncludes(self: *const Linux, tc: *const Toolchain) !void { |
| 411 | try comp.addSystemIncludeDir("/usr/include"); | 411 | try comp.addSystemIncludeDir("/usr/include"); |
| 412 | 412 | ||
| 413 | std.debug.assert(!tc.driver.nostdlibinc); | 413 | std.debug.assert(!tc.driver.nostdlibinc); |
| 414 | if (!tc.driver.nobuiltininc and target.isMusl()) { | 414 | if (!tc.driver.nobuiltininc and target.abi.isMusl()) { |
| 415 | try comp.addBuiltinIncludeDir(tc.driver.aro_name); | 415 | try comp.addBuiltinIncludeDir(tc.driver.aro_name); |
| 416 | } | 416 | } |
| 417 | } | 417 | } |
lib/compiler_rt/common.zig+3-3| ... | @@ -14,7 +14,7 @@ else | ... | @@ -14,7 +14,7 @@ else |
| 14 | /// For WebAssembly this allows the symbol to be resolved to other modules, but will not | 14 | /// For WebAssembly this allows the symbol to be resolved to other modules, but will not |
| 15 | /// export it to the host runtime. | 15 | /// export it to the host runtime. |
| 16 | pub const visibility: std.builtin.SymbolVisibility = | 16 | pub const visibility: std.builtin.SymbolVisibility = |
| 17 | if (builtin.target.isWasm() and linkage != .internal) .hidden else .default; | 17 | if (builtin.target.cpu.arch.isWasm() and linkage != .internal) .hidden else .default; |
| 18 | 18 | ||
| 19 | pub const want_aeabi = switch (builtin.abi) { | 19 | pub const want_aeabi = switch (builtin.abi) { |
| 20 | .eabi, | 20 | .eabi, |
| ... | @@ -92,7 +92,7 @@ pub const panic = if (builtin.is_test) std.debug.FullPanic(std.debug.defaultPani | ... | @@ -92,7 +92,7 @@ pub const panic = if (builtin.is_test) std.debug.FullPanic(std.debug.defaultPani |
| 92 | pub fn F16T(comptime OtherType: type) type { | 92 | pub fn F16T(comptime OtherType: type) type { |
| 93 | return switch (builtin.cpu.arch) { | 93 | return switch (builtin.cpu.arch) { |
| 94 | .arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8)) | 94 | .arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8)) |
| 95 | switch (builtin.abi.floatAbi()) { | 95 | switch (builtin.abi.float()) { |
| 96 | .soft => u16, | 96 | .soft => u16, |
| 97 | .hard => f16, | 97 | .hard => f16, |
| 98 | } | 98 | } |
| ... | @@ -100,7 +100,7 @@ pub fn F16T(comptime OtherType: type) type { | ... | @@ -100,7 +100,7 @@ pub fn F16T(comptime OtherType: type) type { |
| 100 | u16, | 100 | u16, |
| 101 | .aarch64, .aarch64_be => f16, | 101 | .aarch64, .aarch64_be => f16, |
| 102 | .riscv32, .riscv64 => f16, | 102 | .riscv32, .riscv64 => f16, |
| 103 | .x86, .x86_64 => if (builtin.target.isDarwin()) switch (OtherType) { | 103 | .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) { |
| 104 | // Starting with LLVM 16, Darwin uses different abi for f16 | 104 | // Starting with LLVM 16, Darwin uses different abi for f16 |
| 105 | // depending on the type of the other return/argument..??? | 105 | // depending on the type of the other return/argument..??? |
| 106 | f32, f64 => u16, | 106 | f32, f64 => u16, |
lib/std/Build/Step/Compile.zig+3-3| ... | @@ -465,7 +465,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { | ... | @@ -465,7 +465,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 465 | if (compile.linkage != null and compile.linkage.? == .static) { | 465 | if (compile.linkage != null and compile.linkage.? == .static) { |
| 466 | compile.out_lib_filename = compile.out_filename; | 466 | compile.out_lib_filename = compile.out_filename; |
| 467 | } else if (compile.version) |version| { | 467 | } else if (compile.version) |version| { |
| 468 | if (target.isDarwin()) { | 468 | if (target.os.tag.isDarwin()) { |
| 469 | compile.major_only_filename = owner.fmt("lib{s}.{d}.dylib", .{ | 469 | compile.major_only_filename = owner.fmt("lib{s}.{d}.dylib", .{ |
| 470 | compile.name, | 470 | compile.name, |
| 471 | version.major, | 471 | version.major, |
| ... | @@ -480,7 +480,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { | ... | @@ -480,7 +480,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 480 | compile.out_lib_filename = compile.out_filename; | 480 | compile.out_lib_filename = compile.out_filename; |
| 481 | } | 481 | } |
| 482 | } else { | 482 | } else { |
| 483 | if (target.isDarwin()) { | 483 | if (target.os.tag.isDarwin()) { |
| 484 | compile.out_lib_filename = compile.out_filename; | 484 | compile.out_lib_filename = compile.out_filename; |
| 485 | } else if (target.os.tag == .windows) { | 485 | } else if (target.os.tag == .windows) { |
| 486 | compile.out_lib_filename = owner.fmt("{s}.lib", .{compile.name}); | 486 | compile.out_lib_filename = owner.fmt("{s}.lib", .{compile.name}); |
| ... | @@ -1524,7 +1524,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { | ... | @@ -1524,7 +1524,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1524 | try zig_args.append(b.fmt("{}", .{version})); | 1524 | try zig_args.append(b.fmt("{}", .{version})); |
| 1525 | } | 1525 | } |
| 1526 | 1526 | ||
| 1527 | if (compile.rootModuleTarget().isDarwin()) { | 1527 | if (compile.rootModuleTarget().os.tag.isDarwin()) { |
| 1528 | const install_name = compile.install_name orelse b.fmt("@rpath/{s}{s}{s}", .{ | 1528 | const install_name = compile.install_name orelse b.fmt("@rpath/{s}{s}{s}", .{ |
| 1529 | compile.rootModuleTarget().libPrefix(), | 1529 | compile.rootModuleTarget().libPrefix(), |
| 1530 | compile.name, | 1530 | compile.name, |
lib/std/Target.zig+24-42| ... | @@ -144,10 +144,6 @@ pub const Os = struct { | ... | @@ -144,10 +144,6 @@ pub const Os = struct { |
| 144 | }; | 144 | }; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | pub inline fn isGnuLibC(tag: Os.Tag, abi: Abi) bool { | ||
| 148 | return (tag == .hurd or tag == .linux) and abi.isGnu(); | ||
| 149 | } | ||
| 150 | |||
| 151 | pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch, abi: Abi) Os { | 147 | pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch, abi: Abi) Os { |
| 152 | return .{ | 148 | return .{ |
| 153 | .tag = tag, | 149 | .tag = tag, |
| ... | @@ -973,7 +969,12 @@ pub const Abi = enum { | ... | @@ -973,7 +969,12 @@ pub const Abi = enum { |
| 973 | }; | 969 | }; |
| 974 | } | 970 | } |
| 975 | 971 | ||
| 976 | pub inline fn floatAbi(abi: Abi) FloatAbi { | 972 | pub const Float = enum { |
| 973 | hard, | ||
| 974 | soft, | ||
| 975 | }; | ||
| 976 | |||
| 977 | pub inline fn float(abi: Abi) Float { | ||
| 977 | return switch (abi) { | 978 | return switch (abi) { |
| 978 | .androideabi, | 979 | .androideabi, |
| 979 | .eabi, | 980 | .eabi, |
| ... | @@ -2022,48 +2023,29 @@ pub fn libPrefix(target: Target) [:0]const u8 { | ... | @@ -2022,48 +2023,29 @@ pub fn libPrefix(target: Target) [:0]const u8 { |
| 2022 | } | 2023 | } |
| 2023 | 2024 | ||
| 2024 | pub inline fn isMinGW(target: Target) bool { | 2025 | pub inline fn isMinGW(target: Target) bool { |
| 2025 | return target.os.tag == .windows and target.isGnu(); | 2026 | return target.os.tag == .windows and target.abi.isGnu(); |
| 2026 | } | ||
| 2027 | |||
| 2028 | pub inline fn isGnu(target: Target) bool { | ||
| 2029 | return target.abi.isGnu(); | ||
| 2030 | } | ||
| 2031 | |||
| 2032 | pub inline fn isMusl(target: Target) bool { | ||
| 2033 | return target.abi.isMusl(); | ||
| 2034 | } | ||
| 2035 | |||
| 2036 | pub inline fn isAndroid(target: Target) bool { | ||
| 2037 | return target.abi.isAndroid(); | ||
| 2038 | } | ||
| 2039 | |||
| 2040 | pub inline fn isWasm(target: Target) bool { | ||
| 2041 | return target.cpu.arch.isWasm(); | ||
| 2042 | } | ||
| 2043 | |||
| 2044 | pub inline fn isDarwin(target: Target) bool { | ||
| 2045 | return target.os.tag.isDarwin(); | ||
| 2046 | } | ||
| 2047 | |||
| 2048 | pub inline fn isBSD(target: Target) bool { | ||
| 2049 | return target.os.tag.isBSD(); | ||
| 2050 | } | 2027 | } |
| 2051 | 2028 | ||
| 2052 | pub inline fn isGnuLibC(target: Target) bool { | 2029 | pub inline fn isGnuLibC(target: Target) bool { |
| 2053 | return target.os.tag.isGnuLibC(target.abi); | 2030 | return switch (target.os.tag) { |
| 2031 | .hurd, .linux => target.abi.isGnu(), | ||
| 2032 | else => false, | ||
| 2033 | }; | ||
| 2054 | } | 2034 | } |
| 2055 | 2035 | ||
| 2056 | pub inline fn isSpirV(target: Target) bool { | 2036 | pub inline fn isMuslLibC(target: Target) bool { |
| 2057 | return target.cpu.arch.isSpirV(); | 2037 | return target.os.tag == .linux and target.abi.isMusl(); |
| 2058 | } | 2038 | } |
| 2059 | 2039 | ||
| 2060 | pub const FloatAbi = enum { | 2040 | pub inline fn isDarwinLibC(target: Target) bool { |
| 2061 | hard, | 2041 | return switch (target.abi) { |
| 2062 | soft, | 2042 | .none, .macabi, .simulator => target.os.tag.isDarwin(), |
| 2063 | }; | 2043 | else => false, |
| 2044 | }; | ||
| 2045 | } | ||
| 2064 | 2046 | ||
| 2065 | pub inline fn floatAbi(target: Target) FloatAbi { | 2047 | pub inline fn isWasiLibC(target: Target) bool { |
| 2066 | return target.abi.floatAbi(); | 2048 | return target.os.tag == .wasi and target.abi.isMusl(); |
| 2067 | } | 2049 | } |
| 2068 | 2050 | ||
| 2069 | pub const DynamicLinker = struct { | 2051 | pub const DynamicLinker = struct { |
| ... | @@ -2699,7 +2681,7 @@ pub fn stackAlignment(target: Target) u16 { | ... | @@ -2699,7 +2681,7 @@ pub fn stackAlignment(target: Target) u16 { |
| 2699 | /// Note that char signedness is implementation-defined and many compilers provide | 2681 | /// Note that char signedness is implementation-defined and many compilers provide |
| 2700 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char | 2682 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| 2701 | pub fn charSignedness(target: Target) std.builtin.Signedness { | 2683 | pub fn charSignedness(target: Target) std.builtin.Signedness { |
| 2702 | if (target.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; | 2684 | if (target.os.tag.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; |
| 2703 | 2685 | ||
| 2704 | return switch (target.cpu.arch) { | 2686 | return switch (target.cpu.arch) { |
| 2705 | .arm, | 2687 | .arm, |
| ... | @@ -3292,7 +3274,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { | ... | @@ -3292,7 +3274,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { |
| 3292 | .windows => .{ .aarch64_aapcs_win = .{} }, | 3274 | .windows => .{ .aarch64_aapcs_win = .{} }, |
| 3293 | else => .{ .aarch64_aapcs = .{} }, | 3275 | else => .{ .aarch64_aapcs = .{} }, |
| 3294 | }, | 3276 | }, |
| 3295 | .arm, .armeb, .thumb, .thumbeb => switch (target.abi.floatAbi()) { | 3277 | .arm, .armeb, .thumb, .thumbeb => switch (target.abi.float()) { |
| 3296 | .soft => .{ .arm_aapcs = .{} }, | 3278 | .soft => .{ .arm_aapcs = .{} }, |
| 3297 | .hard => .{ .arm_aapcs_vfp = .{} }, | 3279 | .hard => .{ .arm_aapcs_vfp = .{} }, |
| 3298 | }, | 3280 | }, |
| ... | @@ -3305,7 +3287,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { | ... | @@ -3305,7 +3287,7 @@ pub fn cCallingConvention(target: Target) ?std.builtin.CallingConvention { |
| 3305 | .riscv32 => .{ .riscv32_ilp32 = .{} }, | 3287 | .riscv32 => .{ .riscv32_ilp32 = .{} }, |
| 3306 | .sparc64 => .{ .sparc64_sysv = .{} }, | 3288 | .sparc64 => .{ .sparc64_sysv = .{} }, |
| 3307 | .sparc => .{ .sparc_sysv = .{} }, | 3289 | .sparc => .{ .sparc_sysv = .{} }, |
| 3308 | .powerpc64 => if (target.isMusl()) | 3290 | .powerpc64 => if (target.abi.isMusl()) |
| 3309 | .{ .powerpc64_elf_v2 = .{} } | 3291 | .{ .powerpc64_elf_v2 = .{} } |
| 3310 | else | 3292 | else |
| 3311 | .{ .powerpc64_elf = .{} }, | 3293 | .{ .powerpc64_elf = .{} }, |
lib/std/Target/Query.zig+2-3| ... | @@ -26,7 +26,7 @@ os_version_min: ?OsVersion = null, | ... | @@ -26,7 +26,7 @@ os_version_min: ?OsVersion = null, |
| 26 | os_version_max: ?OsVersion = null, | 26 | os_version_max: ?OsVersion = null, |
| 27 | 27 | ||
| 28 | /// `null` means default when cross compiling, or native when `os_tag` is native. | 28 | /// `null` means default when cross compiling, or native when `os_tag` is native. |
| 29 | /// If `isGnuLibC()` is `false`, this must be `null` and is ignored. | 29 | /// If `isGnu()` is `false`, this must be `null` and is ignored. |
| 30 | glibc_version: ?SemanticVersion = null, | 30 | glibc_version: ?SemanticVersion = null, |
| 31 | 31 | ||
| 32 | /// `null` means default when cross compiling, or native when `os_tag` is native. | 32 | /// `null` means default when cross compiling, or native when `os_tag` is native. |
| ... | @@ -235,8 +235,7 @@ pub fn parse(args: ParseOptions) !Query { | ... | @@ -235,8 +235,7 @@ pub fn parse(args: ParseOptions) !Query { |
| 235 | 235 | ||
| 236 | const abi_ver_text = abi_it.rest(); | 236 | const abi_ver_text = abi_it.rest(); |
| 237 | if (abi_it.next() != null) { | 237 | if (abi_it.next() != null) { |
| 238 | const tag = result.os_tag orelse builtin.os.tag; | 238 | if (abi.isGnu()) { |
| 239 | if (tag.isGnuLibC(abi)) { | ||
| 240 | result.glibc_version = parseVersion(abi_ver_text) catch |err| switch (err) { | 239 | result.glibc_version = parseVersion(abi_ver_text) catch |err| switch (err) { |
| 241 | error.Overflow => return error.InvalidAbiVersion, | 240 | error.Overflow => return error.InvalidAbiVersion, |
| 242 | error.InvalidVersion => return error.InvalidAbiVersion, | 241 | error.InvalidVersion => return error.InvalidAbiVersion, |
lib/std/Thread.zig+1-1| ... | @@ -734,7 +734,7 @@ const PosixThreadImpl = struct { | ... | @@ -734,7 +734,7 @@ const PosixThreadImpl = struct { |
| 734 | else => { | 734 | else => { |
| 735 | var count: c_int = undefined; | 735 | var count: c_int = undefined; |
| 736 | var count_len: usize = @sizeOf(c_int); | 736 | var count_len: usize = @sizeOf(c_int); |
| 737 | const name = if (comptime target.isDarwin()) "hw.logicalcpu" else "hw.ncpu"; | 737 | const name = if (comptime target.os.tag.isDarwin()) "hw.logicalcpu" else "hw.ncpu"; |
| 738 | posix.sysctlbynameZ(name, &count, &count_len, null, 0) catch |err| switch (err) { | 738 | posix.sysctlbynameZ(name, &count, &count_len, null, 0) catch |err| switch (err) { |
| 739 | error.NameTooLong, error.UnknownName => unreachable, | 739 | error.NameTooLong, error.UnknownName => unreachable, |
| 740 | else => |e| return e, | 740 | else => |e| return e, |
lib/std/Thread/Futex.zig+1-1| ... | @@ -80,7 +80,7 @@ else if (builtin.os.tag == .openbsd) | ... | @@ -80,7 +80,7 @@ else if (builtin.os.tag == .openbsd) |
| 80 | OpenbsdImpl | 80 | OpenbsdImpl |
| 81 | else if (builtin.os.tag == .dragonfly) | 81 | else if (builtin.os.tag == .dragonfly) |
| 82 | DragonflyImpl | 82 | DragonflyImpl |
| 83 | else if (builtin.target.isWasm()) | 83 | else if (builtin.target.cpu.arch.isWasm()) |
| 84 | WasmImpl | 84 | WasmImpl |
| 85 | else if (std.Thread.use_pthreads) | 85 | else if (std.Thread.use_pthreads) |
| 86 | PosixImpl | 86 | PosixImpl |
lib/std/builtin.zig+1-1| ... | @@ -957,7 +957,7 @@ pub const VaList = switch (builtin.cpu.arch) { | ... | @@ -957,7 +957,7 @@ pub const VaList = switch (builtin.cpu.arch) { |
| 957 | .amdgcn => *u8, | 957 | .amdgcn => *u8, |
| 958 | .avr => *anyopaque, | 958 | .avr => *anyopaque, |
| 959 | .bpfel, .bpfeb => *anyopaque, | 959 | .bpfel, .bpfeb => *anyopaque, |
| 960 | .hexagon => if (builtin.target.isMusl()) VaListHexagon else *u8, | 960 | .hexagon => if (builtin.target.abi.isMusl()) VaListHexagon else *u8, |
| 961 | .loongarch32, .loongarch64 => *anyopaque, | 961 | .loongarch32, .loongarch64 => *anyopaque, |
| 962 | .mips, .mipsel, .mips64, .mips64el => *anyopaque, | 962 | .mips, .mipsel, .mips64, .mips64el => *anyopaque, |
| 963 | .riscv32, .riscv64 => *anyopaque, | 963 | .riscv32, .riscv64 => *anyopaque, |
lib/std/c.zig+6-6| ... | @@ -2808,7 +2808,7 @@ pub const Sigaction = switch (native_os) { | ... | @@ -2808,7 +2808,7 @@ pub const Sigaction = switch (native_os) { |
| 2808 | .mipsel, | 2808 | .mipsel, |
| 2809 | .mips64, | 2809 | .mips64, |
| 2810 | .mips64el, | 2810 | .mips64el, |
| 2811 | => if (builtin.target.isMusl()) | 2811 | => if (builtin.target.abi.isMusl()) |
| 2812 | linux.Sigaction | 2812 | linux.Sigaction |
| 2813 | else if (builtin.target.ptrBitWidth() == 64) extern struct { | 2813 | else if (builtin.target.ptrBitWidth() == 64) extern struct { |
| 2814 | pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; | 2814 | pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; |
| ... | @@ -6701,7 +6701,7 @@ pub const Stat = switch (native_os) { | ... | @@ -6701,7 +6701,7 @@ pub const Stat = switch (native_os) { |
| 6701 | return self.ctim; | 6701 | return self.ctim; |
| 6702 | } | 6702 | } |
| 6703 | }, | 6703 | }, |
| 6704 | .mips, .mipsel => if (builtin.target.isMusl()) extern struct { | 6704 | .mips, .mipsel => if (builtin.target.abi.isMusl()) extern struct { |
| 6705 | dev: dev_t, | 6705 | dev: dev_t, |
| 6706 | __pad0: [2]i32, | 6706 | __pad0: [2]i32, |
| 6707 | ino: ino_t, | 6707 | ino: ino_t, |
| ... | @@ -6762,7 +6762,7 @@ pub const Stat = switch (native_os) { | ... | @@ -6762,7 +6762,7 @@ pub const Stat = switch (native_os) { |
| 6762 | return self.ctim; | 6762 | return self.ctim; |
| 6763 | } | 6763 | } |
| 6764 | }, | 6764 | }, |
| 6765 | .mips64, .mips64el => if (builtin.target.isMusl()) extern struct { | 6765 | .mips64, .mips64el => if (builtin.target.abi.isMusl()) extern struct { |
| 6766 | dev: dev_t, | 6766 | dev: dev_t, |
| 6767 | __pad0: [3]i32, | 6767 | __pad0: [3]i32, |
| 6768 | ino: ino_t, | 6768 | ino: ino_t, |
| ... | @@ -9863,16 +9863,16 @@ pub const LC = enum(c_int) { | ... | @@ -9863,16 +9863,16 @@ pub const LC = enum(c_int) { |
| 9863 | 9863 | ||
| 9864 | pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8; | 9864 | pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8; |
| 9865 | 9865 | ||
| 9866 | pub const getcontext = if (builtin.target.isAndroid() or builtin.target.os.tag == .openbsd) | 9866 | pub const getcontext = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd) |
| 9867 | {} // android bionic and openbsd libc does not implement getcontext | 9867 | {} // android bionic and openbsd libc does not implement getcontext |
| 9868 | else if (native_os == .linux and builtin.target.isMusl()) | 9868 | else if (native_os == .linux and builtin.target.abi.isMusl()) |
| 9869 | linux.getcontext | 9869 | linux.getcontext |
| 9870 | else | 9870 | else |
| 9871 | private.getcontext; | 9871 | private.getcontext; |
| 9872 | 9872 | ||
| 9873 | pub const max_align_t = if (native_abi == .msvc or native_abi == .itanium) | 9873 | pub const max_align_t = if (native_abi == .msvc or native_abi == .itanium) |
| 9874 | f64 | 9874 | f64 |
| 9875 | else if (builtin.target.isDarwin()) | 9875 | else if (native_os.isDarwin()) |
| 9876 | c_longdouble | 9876 | c_longdouble |
| 9877 | else | 9877 | else |
| 9878 | extern struct { | 9878 | extern struct { |
lib/std/c/darwin.zig+1-1| ... | @@ -979,7 +979,7 @@ pub const kevent64_s = extern struct { | ... | @@ -979,7 +979,7 @@ pub const kevent64_s = extern struct { |
| 979 | // to make sure the struct is laid out the same. These values were | 979 | // to make sure the struct is laid out the same. These values were |
| 980 | // produced from C code using the offsetof macro. | 980 | // produced from C code using the offsetof macro. |
| 981 | comptime { | 981 | comptime { |
| 982 | if (builtin.target.isDarwin()) { | 982 | if (builtin.target.os.tag.isDarwin()) { |
| 983 | assert(@offsetOf(kevent64_s, "ident") == 0); | 983 | assert(@offsetOf(kevent64_s, "ident") == 0); |
| 984 | assert(@offsetOf(kevent64_s, "filter") == 8); | 984 | assert(@offsetOf(kevent64_s, "filter") == 8); |
| 985 | assert(@offsetOf(kevent64_s, "flags") == 10); | 985 | assert(@offsetOf(kevent64_s, "flags") == 10); |
lib/std/debug.zig+4-4| ... | @@ -292,7 +292,7 @@ pub fn dumpHexFallible(bytes: []const u8) !void { | ... | @@ -292,7 +292,7 @@ pub fn dumpHexFallible(bytes: []const u8) !void { |
| 292 | /// TODO multithreaded awareness | 292 | /// TODO multithreaded awareness |
| 293 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { | 293 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 294 | nosuspend { | 294 | nosuspend { |
| 295 | if (builtin.target.isWasm()) { | 295 | if (builtin.target.cpu.arch.isWasm()) { |
| 296 | if (native_os == .wasi) { | 296 | if (native_os == .wasi) { |
| 297 | const stderr = io.getStdErr().writer(); | 297 | const stderr = io.getStdErr().writer(); |
| 298 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; | 298 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| ... | @@ -380,7 +380,7 @@ pub inline fn getContext(context: *ThreadContext) bool { | ... | @@ -380,7 +380,7 @@ pub inline fn getContext(context: *ThreadContext) bool { |
| 380 | /// TODO multithreaded awareness | 380 | /// TODO multithreaded awareness |
| 381 | pub fn dumpStackTraceFromBase(context: *ThreadContext) void { | 381 | pub fn dumpStackTraceFromBase(context: *ThreadContext) void { |
| 382 | nosuspend { | 382 | nosuspend { |
| 383 | if (builtin.target.isWasm()) { | 383 | if (builtin.target.cpu.arch.isWasm()) { |
| 384 | if (native_os == .wasi) { | 384 | if (native_os == .wasi) { |
| 385 | const stderr = io.getStdErr().writer(); | 385 | const stderr = io.getStdErr().writer(); |
| 386 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; | 386 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| ... | @@ -478,7 +478,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *std.builtin.StackT | ... | @@ -478,7 +478,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *std.builtin.StackT |
| 478 | /// TODO multithreaded awareness | 478 | /// TODO multithreaded awareness |
| 479 | pub fn dumpStackTrace(stack_trace: std.builtin.StackTrace) void { | 479 | pub fn dumpStackTrace(stack_trace: std.builtin.StackTrace) void { |
| 480 | nosuspend { | 480 | nosuspend { |
| 481 | if (builtin.target.isWasm()) { | 481 | if (builtin.target.cpu.arch.isWasm()) { |
| 482 | if (native_os == .wasi) { | 482 | if (native_os == .wasi) { |
| 483 | const stderr = io.getStdErr().writer(); | 483 | const stderr = io.getStdErr().writer(); |
| 484 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; | 484 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| ... | @@ -759,7 +759,7 @@ pub const StackIterator = struct { | ... | @@ -759,7 +759,7 @@ pub const StackIterator = struct { |
| 759 | pub fn initWithContext(first_address: ?usize, debug_info: *SelfInfo, context: *posix.ucontext_t) !StackIterator { | 759 | pub fn initWithContext(first_address: ?usize, debug_info: *SelfInfo, context: *posix.ucontext_t) !StackIterator { |
| 760 | // The implementation of DWARF unwinding on aarch64-macos is not complete. However, Apple mandates that | 760 | // The implementation of DWARF unwinding on aarch64-macos is not complete. However, Apple mandates that |
| 761 | // the frame pointer register is always used, so on this platform we can safely use the FP-based unwinder. | 761 | // the frame pointer register is always used, so on this platform we can safely use the FP-based unwinder. |
| 762 | if (builtin.target.isDarwin() and native_arch == .aarch64) | 762 | if (builtin.target.os.tag.isDarwin() and native_arch == .aarch64) |
| 763 | return init(first_address, @truncate(context.mcontext.ss.fp)); | 763 | return init(first_address, @truncate(context.mcontext.ss.fp)); |
| 764 | 764 | ||
| 765 | if (SelfInfo.supports_unwinding) { | 765 | if (SelfInfo.supports_unwinding) { |
lib/std/debug/SelfInfo.zig+4-4| ... | @@ -121,13 +121,13 @@ pub fn deinit(self: *SelfInfo) void { | ... | @@ -121,13 +121,13 @@ pub fn deinit(self: *SelfInfo) void { |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | pub fn getModuleForAddress(self: *SelfInfo, address: usize) !*Module { | 123 | pub fn getModuleForAddress(self: *SelfInfo, address: usize) !*Module { |
| 124 | if (builtin.target.isDarwin()) { | 124 | if (builtin.target.os.tag.isDarwin()) { |
| 125 | return self.lookupModuleDyld(address); | 125 | return self.lookupModuleDyld(address); |
| 126 | } else if (native_os == .windows) { | 126 | } else if (native_os == .windows) { |
| 127 | return self.lookupModuleWin32(address); | 127 | return self.lookupModuleWin32(address); |
| 128 | } else if (native_os == .haiku) { | 128 | } else if (native_os == .haiku) { |
| 129 | return self.lookupModuleHaiku(address); | 129 | return self.lookupModuleHaiku(address); |
| 130 | } else if (builtin.target.isWasm()) { | 130 | } else if (builtin.target.cpu.arch.isWasm()) { |
| 131 | return self.lookupModuleWasm(address); | 131 | return self.lookupModuleWasm(address); |
| 132 | } else { | 132 | } else { |
| 133 | return self.lookupModuleDl(address); | 133 | return self.lookupModuleDl(address); |
| ... | @@ -138,13 +138,13 @@ pub fn getModuleForAddress(self: *SelfInfo, address: usize) !*Module { | ... | @@ -138,13 +138,13 @@ pub fn getModuleForAddress(self: *SelfInfo, address: usize) !*Module { |
| 138 | // This can be called when getModuleForAddress fails, so implementations should provide | 138 | // This can be called when getModuleForAddress fails, so implementations should provide |
| 139 | // a path that doesn't rely on any side-effects of a prior successful module lookup. | 139 | // a path that doesn't rely on any side-effects of a prior successful module lookup. |
| 140 | pub fn getModuleNameForAddress(self: *SelfInfo, address: usize) ?[]const u8 { | 140 | pub fn getModuleNameForAddress(self: *SelfInfo, address: usize) ?[]const u8 { |
| 141 | if (builtin.target.isDarwin()) { | 141 | if (builtin.target.os.tag.isDarwin()) { |
| 142 | return self.lookupModuleNameDyld(address); | 142 | return self.lookupModuleNameDyld(address); |
| 143 | } else if (native_os == .windows) { | 143 | } else if (native_os == .windows) { |
| 144 | return self.lookupModuleNameWin32(address); | 144 | return self.lookupModuleNameWin32(address); |
| 145 | } else if (native_os == .haiku) { | 145 | } else if (native_os == .haiku) { |
| 146 | return null; | 146 | return null; |
| 147 | } else if (builtin.target.isWasm()) { | 147 | } else if (builtin.target.cpu.arch.isWasm()) { |
| 148 | return null; | 148 | return null; |
| 149 | } else { | 149 | } else { |
| 150 | return self.lookupModuleNameDl(address); | 150 | return self.lookupModuleNameDl(address); |
lib/std/fs/Dir.zig+1-1| ... | @@ -2587,7 +2587,7 @@ const CopyFileRawError = error{SystemResources} || posix.CopyFileRangeError || p | ... | @@ -2587,7 +2587,7 @@ const CopyFileRawError = error{SystemResources} || posix.CopyFileRangeError || p |
| 2587 | // The copy starts at offset 0, the initial offsets are preserved. | 2587 | // The copy starts at offset 0, the initial offsets are preserved. |
| 2588 | // No metadata is transferred over. | 2588 | // No metadata is transferred over. |
| 2589 | fn copy_file(fd_in: posix.fd_t, fd_out: posix.fd_t, maybe_size: ?u64) CopyFileRawError!void { | 2589 | fn copy_file(fd_in: posix.fd_t, fd_out: posix.fd_t, maybe_size: ?u64) CopyFileRawError!void { |
| 2590 | if (builtin.target.isDarwin()) { | 2590 | if (builtin.target.os.tag.isDarwin()) { |
| 2591 | const rc = posix.system.fcopyfile(fd_in, fd_out, null, .{ .DATA = true }); | 2591 | const rc = posix.system.fcopyfile(fd_in, fd_out, null, .{ .DATA = true }); |
| 2592 | switch (posix.errno(rc)) { | 2592 | switch (posix.errno(rc)) { |
| 2593 | .SUCCESS => return, | 2593 | .SUCCESS => return, |
lib/std/heap.zig+3-3| ... | @@ -348,7 +348,7 @@ pub const page_allocator: Allocator = if (@hasDecl(root, "os") and | ... | @@ -348,7 +348,7 @@ pub const page_allocator: Allocator = if (@hasDecl(root, "os") and |
| 348 | @hasDecl(root.os, "heap") and | 348 | @hasDecl(root.os, "heap") and |
| 349 | @hasDecl(root.os.heap, "page_allocator")) | 349 | @hasDecl(root.os.heap, "page_allocator")) |
| 350 | root.os.heap.page_allocator | 350 | root.os.heap.page_allocator |
| 351 | else if (builtin.target.isWasm()) .{ | 351 | else if (builtin.target.cpu.arch.isWasm()) .{ |
| 352 | .ptr = undefined, | 352 | .ptr = undefined, |
| 353 | .vtable = &WasmAllocator.vtable, | 353 | .vtable = &WasmAllocator.vtable, |
| 354 | } else if (builtin.target.os.tag == .plan9) .{ | 354 | } else if (builtin.target.os.tag == .plan9) .{ |
| ... | @@ -508,7 +508,7 @@ test PageAllocator { | ... | @@ -508,7 +508,7 @@ test PageAllocator { |
| 508 | const allocator = page_allocator; | 508 | const allocator = page_allocator; |
| 509 | try testAllocator(allocator); | 509 | try testAllocator(allocator); |
| 510 | try testAllocatorAligned(allocator); | 510 | try testAllocatorAligned(allocator); |
| 511 | if (!builtin.target.isWasm()) { | 511 | if (!builtin.target.cpu.arch.isWasm()) { |
| 512 | try testAllocatorLargeAlignment(allocator); | 512 | try testAllocatorLargeAlignment(allocator); |
| 513 | try testAllocatorAlignedShrink(allocator); | 513 | try testAllocatorAlignedShrink(allocator); |
| 514 | } | 514 | } |
| ... | @@ -990,7 +990,7 @@ test { | ... | @@ -990,7 +990,7 @@ test { |
| 990 | _ = FixedBufferAllocator; | 990 | _ = FixedBufferAllocator; |
| 991 | _ = ThreadSafeAllocator; | 991 | _ = ThreadSafeAllocator; |
| 992 | _ = SbrkAllocator; | 992 | _ = SbrkAllocator; |
| 993 | if (builtin.target.isWasm()) { | 993 | if (builtin.target.cpu.arch.isWasm()) { |
| 994 | _ = WasmAllocator; | 994 | _ = WasmAllocator; |
| 995 | } | 995 | } |
| 996 | if (!builtin.single_threaded) _ = smp_allocator; | 996 | if (!builtin.single_threaded) _ = smp_allocator; |
lib/std/heap/WasmAllocator.zig+1-1| ... | @@ -7,7 +7,7 @@ const wasm = std.wasm; | ... | @@ -7,7 +7,7 @@ const wasm = std.wasm; |
| 7 | const math = std.math; | 7 | const math = std.math; |
| 8 | 8 | ||
| 9 | comptime { | 9 | comptime { |
| 10 | if (!builtin.target.isWasm()) { | 10 | if (!builtin.target.cpu.arch.isWasm()) { |
| 11 | @compileError("only available for wasm32 arch"); | 11 | @compileError("only available for wasm32 arch"); |
| 12 | } | 12 | } |
| 13 | if (!builtin.single_threaded) { | 13 | if (!builtin.single_threaded) { |
lib/std/heap/debug_allocator.zig+2-2| ... | @@ -1140,7 +1140,7 @@ test "shrink" { | ... | @@ -1140,7 +1140,7 @@ test "shrink" { |
| 1140 | } | 1140 | } |
| 1141 | 1141 | ||
| 1142 | test "large object - grow" { | 1142 | test "large object - grow" { |
| 1143 | if (builtin.target.isWasm()) { | 1143 | if (builtin.target.cpu.arch.isWasm()) { |
| 1144 | // Not expected to pass on targets that do not have memory mapping. | 1144 | // Not expected to pass on targets that do not have memory mapping. |
| 1145 | return error.SkipZigTest; | 1145 | return error.SkipZigTest; |
| 1146 | } | 1146 | } |
| ... | @@ -1319,7 +1319,7 @@ test "realloc large object to larger alignment" { | ... | @@ -1319,7 +1319,7 @@ test "realloc large object to larger alignment" { |
| 1319 | } | 1319 | } |
| 1320 | 1320 | ||
| 1321 | test "large object rejects shrinking to small" { | 1321 | test "large object rejects shrinking to small" { |
| 1322 | if (builtin.target.isWasm()) { | 1322 | if (builtin.target.cpu.arch.isWasm()) { |
| 1323 | // Not expected to pass on targets that do not have memory mapping. | 1323 | // Not expected to pass on targets that do not have memory mapping. |
| 1324 | return error.SkipZigTest; | 1324 | return error.SkipZigTest; |
| 1325 | } | 1325 | } |
lib/std/math/big/int_test.zig+1-1| ... | @@ -2262,7 +2262,7 @@ test "bitNotWrap more than two limbs" { | ... | @@ -2262,7 +2262,7 @@ test "bitNotWrap more than two limbs" { |
| 2262 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 2262 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2263 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 2263 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2264 | // LLVM: unexpected runtime library name: __umodei4 | 2264 | // LLVM: unexpected runtime library name: __umodei4 |
| 2265 | if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.isWasm()) return error.SkipZigTest; // TODO | 2265 | if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.cpu.arch.isWasm()) return error.SkipZigTest; // TODO |
| 2266 | 2266 | ||
| 2267 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); | 2267 | var a = try Managed.initSet(testing.allocator, maxInt(Limb)); |
| 2268 | defer a.deinit(); | 2268 | defer a.deinit(); |
lib/std/math/gamma.zig+1-1| ... | @@ -263,7 +263,7 @@ test gamma { | ... | @@ -263,7 +263,7 @@ test gamma { |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | test "gamma.special" { | 265 | test "gamma.special" { |
| 266 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 266 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 267 | 267 | ||
| 268 | inline for (&.{ f32, f64 }) |T| { | 268 | inline for (&.{ f32, f64 }) |T| { |
| 269 | try expect(std.math.isNan(gamma(T, -std.math.nan(T)))); | 269 | try expect(std.math.isNan(gamma(T, -std.math.nan(T)))); |
lib/std/math/log10.zig+1-1| ... | @@ -135,7 +135,7 @@ test log10_int { | ... | @@ -135,7 +135,7 @@ test log10_int { |
| 135 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 135 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 136 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 136 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 137 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 137 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 138 | if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.isWasm()) return error.SkipZigTest; // TODO | 138 | if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.cpu.arch.isWasm()) return error.SkipZigTest; // TODO |
| 139 | 139 | ||
| 140 | inline for ( | 140 | inline for ( |
| 141 | .{ u8, u16, u32, u64, u128, u256, u512 }, | 141 | .{ u8, u16, u32, u64, u128, u256, u512 }, |
lib/std/posix.zig+2-2| ... | @@ -3583,7 +3583,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t | ... | @@ -3583,7 +3583,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t |
| 3583 | return rc; | 3583 | return rc; |
| 3584 | } | 3584 | } |
| 3585 | 3585 | ||
| 3586 | const have_sock_flags = !builtin.target.isDarwin() and native_os != .haiku; | 3586 | const have_sock_flags = !builtin.target.os.tag.isDarwin() and native_os != .haiku; |
| 3587 | const filtered_sock_type = if (!have_sock_flags) | 3587 | const filtered_sock_type = if (!have_sock_flags) |
| 3588 | socket_type & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC) | 3588 | socket_type & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC) |
| 3589 | else | 3589 | else |
| ... | @@ -3879,7 +3879,7 @@ pub fn accept( | ... | @@ -3879,7 +3879,7 @@ pub fn accept( |
| 3879 | /// description of the `CLOEXEC` flag in `open` for reasons why this may be useful. | 3879 | /// description of the `CLOEXEC` flag in `open` for reasons why this may be useful. |
| 3880 | flags: u32, | 3880 | flags: u32, |
| 3881 | ) AcceptError!socket_t { | 3881 | ) AcceptError!socket_t { |
| 3882 | const have_accept4 = !(builtin.target.isDarwin() or native_os == .windows or native_os == .haiku); | 3882 | const have_accept4 = !(builtin.target.os.tag.isDarwin() or native_os == .windows or native_os == .haiku); |
| 3883 | assert(0 == (flags & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC))); // Unsupported flag(s) | 3883 | assert(0 == (flags & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC))); // Unsupported flag(s) |
| 3884 | 3884 | ||
| 3885 | const accepted_sock: socket_t = while (true) { | 3885 | const accepted_sock: socket_t = while (true) { |
lib/std/zig/LibCDirs.zig+2-2| ... | @@ -127,7 +127,7 @@ fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibC | ... | @@ -127,7 +127,7 @@ fn detectFromInstallation(arena: Allocator, target: std.Target, lci: *const LibC |
| 127 | 127 | ||
| 128 | var sysroot: ?[]const u8 = null; | 128 | var sysroot: ?[]const u8 = null; |
| 129 | 129 | ||
| 130 | if (target.isDarwin()) d: { | 130 | if (target.os.tag.isDarwin()) d: { |
| 131 | const down1 = std.fs.path.dirname(lci.sys_include_dir.?) orelse break :d; | 131 | const down1 = std.fs.path.dirname(lci.sys_include_dir.?) orelse break :d; |
| 132 | const down2 = std.fs.path.dirname(down1) orelse break :d; | 132 | const down2 = std.fs.path.dirname(down1) orelse break :d; |
| 133 | try framework_list.append(try std.fs.path.join(arena, &.{ down2, "System", "Library", "Frameworks" })); | 133 | try framework_list.append(try std.fs.path.join(arena, &.{ down2, "System", "Library", "Frameworks" })); |
| ... | @@ -150,7 +150,7 @@ pub fn detectFromBuilding( | ... | @@ -150,7 +150,7 @@ pub fn detectFromBuilding( |
| 150 | ) !LibCDirs { | 150 | ) !LibCDirs { |
| 151 | const s = std.fs.path.sep_str; | 151 | const s = std.fs.path.sep_str; |
| 152 | 152 | ||
| 153 | if (target.isDarwin()) { | 153 | if (target.os.tag.isDarwin()) { |
| 154 | const list = try arena.alloc([]const u8, 1); | 154 | const list = try arena.alloc([]const u8, 1); |
| 155 | list[0] = try std.fmt.allocPrint( | 155 | list[0] = try std.fmt.allocPrint( |
| 156 | arena, | 156 | arena, |
lib/std/zig/LibCInstallation.zig+5-5| ... | @@ -81,7 +81,7 @@ pub fn parse( | ... | @@ -81,7 +81,7 @@ pub fn parse( |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | const os_tag = target.os.tag; | 83 | const os_tag = target.os.tag; |
| 84 | if (self.crt_dir == null and !target.isDarwin()) { | 84 | if (self.crt_dir == null and !target.os.tag.isDarwin()) { |
| 85 | log.err("crt_dir may not be empty for {s}", .{@tagName(os_tag)}); | 85 | log.err("crt_dir may not be empty for {s}", .{@tagName(os_tag)}); |
| 86 | return error.ParseError; | 86 | return error.ParseError; |
| 87 | } | 87 | } |
| ... | @@ -167,7 +167,7 @@ pub const FindNativeOptions = struct { | ... | @@ -167,7 +167,7 @@ pub const FindNativeOptions = struct { |
| 167 | pub fn findNative(args: FindNativeOptions) FindError!LibCInstallation { | 167 | pub fn findNative(args: FindNativeOptions) FindError!LibCInstallation { |
| 168 | var self: LibCInstallation = .{}; | 168 | var self: LibCInstallation = .{}; |
| 169 | 169 | ||
| 170 | if (is_darwin and args.target.isDarwin()) { | 170 | if (is_darwin and args.target.os.tag.isDarwin()) { |
| 171 | if (!std.zig.system.darwin.isSdkInstalled(args.allocator)) | 171 | if (!std.zig.system.darwin.isSdkInstalled(args.allocator)) |
| 172 | return error.DarwinSdkNotFound; | 172 | return error.DarwinSdkNotFound; |
| 173 | const sdk = std.zig.system.darwin.getSdk(args.allocator, args.target) orelse | 173 | const sdk = std.zig.system.darwin.getSdk(args.allocator, args.target) orelse |
| ... | @@ -444,7 +444,7 @@ fn findNativeCrtDirPosix(self: *LibCInstallation, args: FindNativeOptions) FindE | ... | @@ -444,7 +444,7 @@ fn findNativeCrtDirPosix(self: *LibCInstallation, args: FindNativeOptions) FindE |
| 444 | self.crt_dir = try ccPrintFileName(.{ | 444 | self.crt_dir = try ccPrintFileName(.{ |
| 445 | .allocator = args.allocator, | 445 | .allocator = args.allocator, |
| 446 | .search_basename = switch (args.target.os.tag) { | 446 | .search_basename = switch (args.target.os.tag) { |
| 447 | .linux => if (args.target.isAndroid()) "crtbegin_dynamic.o" else "crt1.o", | 447 | .linux => if (args.target.abi.isAndroid()) "crtbegin_dynamic.o" else "crt1.o", |
| 448 | else => "crt1.o", | 448 | else => "crt1.o", |
| 449 | }, | 449 | }, |
| 450 | .want_dirname = .only_dir, | 450 | .want_dirname = .only_dir, |
| ... | @@ -734,7 +734,7 @@ pub const CrtBasenames = struct { | ... | @@ -734,7 +734,7 @@ pub const CrtBasenames = struct { |
| 734 | 734 | ||
| 735 | const target = args.target; | 735 | const target = args.target; |
| 736 | 736 | ||
| 737 | if (target.isAndroid()) return switch (mode) { | 737 | if (target.abi.isAndroid()) return switch (mode) { |
| 738 | .dynamic_lib => .{ | 738 | .dynamic_lib => .{ |
| 739 | .crtbegin = "crtbegin_so.o", | 739 | .crtbegin = "crtbegin_so.o", |
| 740 | .crtend = "crtend_so.o", | 740 | .crtend = "crtend_so.o", |
| ... | @@ -1025,7 +1025,7 @@ const fs = std.fs; | ... | @@ -1025,7 +1025,7 @@ const fs = std.fs; |
| 1025 | const Allocator = std.mem.Allocator; | 1025 | const Allocator = std.mem.Allocator; |
| 1026 | const Path = std.Build.Cache.Path; | 1026 | const Path = std.Build.Cache.Path; |
| 1027 | 1027 | ||
| 1028 | const is_darwin = builtin.target.isDarwin(); | 1028 | const is_darwin = builtin.target.os.tag.isDarwin(); |
| 1029 | const is_windows = builtin.target.os.tag == .windows; | 1029 | const is_windows = builtin.target.os.tag == .windows; |
| 1030 | const is_haiku = builtin.target.os.tag == .haiku; | 1030 | const is_haiku = builtin.target.os.tag == .haiku; |
| 1031 | 1031 |
lib/std/zig/system.zig+1-1| ... | @@ -415,7 +415,7 @@ pub fn resolveTargetQuery(query: Target.Query) DetectError!Target { | ... | @@ -415,7 +415,7 @@ pub fn resolveTargetQuery(query: Target.Query) DetectError!Target { |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | // https://github.com/llvm/llvm-project/issues/105978 | 417 | // https://github.com/llvm/llvm-project/issues/105978 |
| 418 | if (result.cpu.arch.isArm() and result.abi.floatAbi() == .soft) { | 418 | if (result.cpu.arch.isArm() and result.abi.float() == .soft) { |
| 419 | result.cpu.features.removeFeature(@intFromEnum(Target.arm.Feature.vfp2)); | 419 | result.cpu.features.removeFeature(@intFromEnum(Target.arm.Feature.vfp2)); |
| 420 | } | 420 | } |
| 421 | } | 421 | } |
lib/std/zig/system/NativePaths.zig+1-1| ... | @@ -83,7 +83,7 @@ pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { | ... | @@ -83,7 +83,7 @@ pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { |
| 83 | 83 | ||
| 84 | // TODO: consider also adding homebrew paths | 84 | // TODO: consider also adding homebrew paths |
| 85 | // TODO: consider also adding macports paths | 85 | // TODO: consider also adding macports paths |
| 86 | if (builtin.target.isDarwin()) { | 86 | if (builtin.target.os.tag.isDarwin()) { |
| 87 | if (std.zig.system.darwin.isSdkInstalled(arena)) sdk: { | 87 | if (std.zig.system.darwin.isSdkInstalled(arena)) sdk: { |
| 88 | const sdk = std.zig.system.darwin.getSdk(arena, native_target) orelse break :sdk; | 88 | const sdk = std.zig.system.darwin.getSdk(arena, native_target) orelse break :sdk; |
| 89 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk, "usr/lib" })); | 89 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk, "usr/lib" })); |
src/Compilation.zig+6-15| ... | @@ -1766,11 +1766,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1766,11 +1766,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1766 | if (comp.config.link_libc and is_exe_or_dyn_lib) { | 1766 | if (comp.config.link_libc and is_exe_or_dyn_lib) { |
| 1767 | // If the "is darwin" check is moved below the libc_installation check below, | 1767 | // If the "is darwin" check is moved below the libc_installation check below, |
| 1768 | // error.LibCInstallationMissingCrtDir is returned from lci.resolveCrtPaths(). | 1768 | // error.LibCInstallationMissingCrtDir is returned from lci.resolveCrtPaths(). |
| 1769 | if (target.isDarwin()) { | 1769 | if (target.isDarwinLibC()) { |
| 1770 | switch (target.abi) { | ||
| 1771 | .none, .simulator, .macabi => {}, | ||
| 1772 | else => return error.LibCUnavailable, | ||
| 1773 | } | ||
| 1774 | // TODO delete logic from MachO flush() and queue up tasks here instead. | 1770 | // TODO delete logic from MachO flush() and queue up tasks here instead. |
| 1775 | } else if (comp.libc_installation) |lci| { | 1771 | } else if (comp.libc_installation) |lci| { |
| 1776 | const basenames = LibCInstallation.CrtBasenames.get(.{ | 1772 | const basenames = LibCInstallation.CrtBasenames.get(.{ |
| ... | @@ -1793,7 +1789,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1793,7 +1789,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1793 | // Loads the libraries provided by `target_util.libcFullLinkFlags(target)`. | 1789 | // Loads the libraries provided by `target_util.libcFullLinkFlags(target)`. |
| 1794 | comp.link_task_queue.shared.appendAssumeCapacity(.load_host_libc); | 1790 | comp.link_task_queue.shared.appendAssumeCapacity(.load_host_libc); |
| 1795 | comp.remaining_prelink_tasks += 1; | 1791 | comp.remaining_prelink_tasks += 1; |
| 1796 | } else if (target.isMusl() and !target.isWasm()) { | 1792 | } else if (target.isMuslLibC()) { |
| 1797 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 1793 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 1798 | 1794 | ||
| 1799 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { | 1795 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { |
| ... | @@ -1817,7 +1813,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1817,7 +1813,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1817 | 1813 | ||
| 1818 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; | 1814 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; |
| 1819 | comp.remaining_prelink_tasks += 1; | 1815 | comp.remaining_prelink_tasks += 1; |
| 1820 | } else if (target.isWasm() and target.os.tag == .wasi) { | 1816 | } else if (target.isWasiLibC()) { |
| 1821 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 1817 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 1822 | 1818 | ||
| 1823 | for (comp.wasi_emulated_libs) |crt_file| { | 1819 | for (comp.wasi_emulated_libs) |crt_file| { |
| ... | @@ -1839,11 +1835,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1839,11 +1835,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1839 | // When linking mingw-w64 there are some import libs we always need. | 1835 | // When linking mingw-w64 there are some import libs we always need. |
| 1840 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); | 1836 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); |
| 1841 | for (mingw.always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {}); | 1837 | for (mingw.always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {}); |
| 1842 | } else if (target.isDarwin()) { | ||
| 1843 | switch (target.abi) { | ||
| 1844 | .none, .simulator, .macabi => {}, | ||
| 1845 | else => return error.LibCUnavailable, | ||
| 1846 | } | ||
| 1847 | } else if (target.os.tag == .freestanding and capable_of_building_zig_libc) { | 1838 | } else if (target.os.tag == .freestanding and capable_of_building_zig_libc) { |
| 1848 | comp.queued_jobs.zig_libc = true; | 1839 | comp.queued_jobs.zig_libc = true; |
| 1849 | comp.remaining_prelink_tasks += 1; | 1840 | comp.remaining_prelink_tasks += 1; |
| ... | @@ -5545,7 +5536,7 @@ pub fn addCCArgs( | ... | @@ -5545,7 +5536,7 @@ pub fn addCCArgs( |
| 5545 | 5536 | ||
| 5546 | // We might want to support -mfloat-abi=softfp for Arm and CSKY here in the future. | 5537 | // We might want to support -mfloat-abi=softfp for Arm and CSKY here in the future. |
| 5547 | if (target_util.clangSupportsFloatAbiArg(target)) { | 5538 | if (target_util.clangSupportsFloatAbiArg(target)) { |
| 5548 | const fabi = @tagName(target.floatAbi()); | 5539 | const fabi = @tagName(target.abi.float()); |
| 5549 | 5540 | ||
| 5550 | try argv.append(switch (target.cpu.arch) { | 5541 | try argv.append(switch (target.cpu.arch) { |
| 5551 | // For whatever reason, Clang doesn't support `-mfloat-abi` for s390x. | 5542 | // For whatever reason, Clang doesn't support `-mfloat-abi` for s390x. |
| ... | @@ -5598,7 +5589,7 @@ pub fn addCCArgs( | ... | @@ -5598,7 +5589,7 @@ pub fn addCCArgs( |
| 5598 | if (ext != .assembly) { | 5589 | if (ext != .assembly) { |
| 5599 | try argv.append(if (target.os.tag == .freestanding) "-ffreestanding" else "-fhosted"); | 5590 | try argv.append(if (target.os.tag == .freestanding) "-ffreestanding" else "-fhosted"); |
| 5600 | 5591 | ||
| 5601 | if (target_util.clangSupportsNoImplicitFloatArg(target) and target.floatAbi() == .soft) { | 5592 | if (target_util.clangSupportsNoImplicitFloatArg(target) and target.abi.float() == .soft) { |
| 5602 | try argv.append("-mno-implicit-float"); | 5593 | try argv.append("-mno-implicit-float"); |
| 5603 | } | 5594 | } |
| 5604 | 5595 | ||
| ... | @@ -5646,7 +5637,7 @@ pub fn addCCArgs( | ... | @@ -5646,7 +5637,7 @@ pub fn addCCArgs( |
| 5646 | // LLVM IR files don't support these flags. | 5637 | // LLVM IR files don't support these flags. |
| 5647 | if (ext != .ll and ext != .bc) { | 5638 | if (ext != .ll and ext != .bc) { |
| 5648 | // https://github.com/llvm/llvm-project/issues/105972 | 5639 | // https://github.com/llvm/llvm-project/issues/105972 |
| 5649 | if (target.cpu.arch.isPowerPC() and target.floatAbi() == .soft) { | 5640 | if (target.cpu.arch.isPowerPC() and target.abi.float() == .soft) { |
| 5650 | try argv.append("-D__NO_FPRS__"); | 5641 | try argv.append("-D__NO_FPRS__"); |
| 5651 | try argv.append("-D_SOFT_FLOAT"); | 5642 | try argv.append("-D_SOFT_FLOAT"); |
| 5652 | try argv.append("-D_SOFT_DOUBLE"); | 5643 | try argv.append("-D_SOFT_DOUBLE"); |
src/Sema.zig+3-3| ... | @@ -9378,7 +9378,7 @@ pub fn handleExternLibName( | ... | @@ -9378,7 +9378,7 @@ pub fn handleExternLibName( |
| 9378 | ); | 9378 | ); |
| 9379 | break :blk; | 9379 | break :blk; |
| 9380 | } | 9380 | } |
| 9381 | if (!target.isWasm() and !block.ownerModule().pic) { | 9381 | if (!target.cpu.arch.isWasm() and !block.ownerModule().pic) { |
| 9382 | return sema.fail( | 9382 | return sema.fail( |
| 9383 | block, | 9383 | block, |
| 9384 | src_loc, | 9384 | src_loc, |
| ... | @@ -26511,7 +26511,7 @@ fn zirWasmMemorySize( | ... | @@ -26511,7 +26511,7 @@ fn zirWasmMemorySize( |
| 26511 | const index_src = block.builtinCallArgSrc(extra.node, 0); | 26511 | const index_src = block.builtinCallArgSrc(extra.node, 0); |
| 26512 | const builtin_src = block.nodeOffset(extra.node); | 26512 | const builtin_src = block.nodeOffset(extra.node); |
| 26513 | const target = sema.pt.zcu.getTarget(); | 26513 | const target = sema.pt.zcu.getTarget(); |
| 26514 | if (!target.isWasm()) { | 26514 | if (!target.cpu.arch.isWasm()) { |
| 26515 | return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); | 26515 | return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); |
| 26516 | } | 26516 | } |
| 26517 | 26517 | ||
| ... | @@ -26536,7 +26536,7 @@ fn zirWasmMemoryGrow( | ... | @@ -26536,7 +26536,7 @@ fn zirWasmMemoryGrow( |
| 26536 | const index_src = block.builtinCallArgSrc(extra.node, 0); | 26536 | const index_src = block.builtinCallArgSrc(extra.node, 0); |
| 26537 | const delta_src = block.builtinCallArgSrc(extra.node, 1); | 26537 | const delta_src = block.builtinCallArgSrc(extra.node, 1); |
| 26538 | const target = sema.pt.zcu.getTarget(); | 26538 | const target = sema.pt.zcu.getTarget(); |
| 26539 | if (!target.isWasm()) { | 26539 | if (!target.cpu.arch.isWasm()) { |
| 26540 | return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); | 26540 | return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); |
| 26541 | } | 26541 | } |
| 26542 | 26542 |
src/arch/x86_64/CodeGen.zig+1-1| ... | @@ -90078,7 +90078,7 @@ fn floatCompilerRtAbiName(float_bits: u32) u8 { | ... | @@ -90078,7 +90078,7 @@ fn floatCompilerRtAbiName(float_bits: u32) u8 { |
| 90078 | fn floatCompilerRtAbiType(self: *CodeGen, ty: Type, other_ty: Type) Type { | 90078 | fn floatCompilerRtAbiType(self: *CodeGen, ty: Type, other_ty: Type) Type { |
| 90079 | if (ty.toIntern() == .f16_type and | 90079 | if (ty.toIntern() == .f16_type and |
| 90080 | (other_ty.toIntern() == .f32_type or other_ty.toIntern() == .f64_type) and | 90080 | (other_ty.toIntern() == .f32_type or other_ty.toIntern() == .f64_type) and |
| 90081 | self.target.isDarwin()) return .u16; | 90081 | self.target.os.tag.isDarwin()) return .u16; |
| 90082 | return ty; | 90082 | return ty; |
| 90083 | } | 90083 | } |
| 90084 | 90084 |
src/codegen/llvm.zig+9-9| ... | @@ -1301,7 +1301,7 @@ pub const Object = struct { | ... | @@ -1301,7 +1301,7 @@ pub const Object = struct { |
| 1301 | .large => .Large, | 1301 | .large => .Large, |
| 1302 | }; | 1302 | }; |
| 1303 | 1303 | ||
| 1304 | const float_abi: llvm.TargetMachine.FloatABI = if (comp.root_mod.resolved_target.result.floatAbi() == .hard) | 1304 | const float_abi: llvm.TargetMachine.FloatABI = if (comp.root_mod.resolved_target.result.abi.float() == .hard) |
| 1305 | .Hard | 1305 | .Hard |
| 1306 | else | 1306 | else |
| 1307 | .Soft; | 1307 | .Soft; |
| ... | @@ -2939,7 +2939,7 @@ pub const Object = struct { | ... | @@ -2939,7 +2939,7 @@ pub const Object = struct { |
| 2939 | function_index.setLinkage(.internal, &o.builder); | 2939 | function_index.setLinkage(.internal, &o.builder); |
| 2940 | function_index.setUnnamedAddr(.unnamed_addr, &o.builder); | 2940 | function_index.setUnnamedAddr(.unnamed_addr, &o.builder); |
| 2941 | } else { | 2941 | } else { |
| 2942 | if (target.isWasm()) { | 2942 | if (target.cpu.arch.isWasm()) { |
| 2943 | try attributes.addFnAttr(.{ .string = .{ | 2943 | try attributes.addFnAttr(.{ .string = .{ |
| 2944 | .kind = try o.builder.string("wasm-import-name"), | 2944 | .kind = try o.builder.string("wasm-import-name"), |
| 2945 | .value = try o.builder.string(nav.name.toSlice(ip)), | 2945 | .value = try o.builder.string(nav.name.toSlice(ip)), |
| ... | @@ -3156,7 +3156,7 @@ pub const Object = struct { | ... | @@ -3156,7 +3156,7 @@ pub const Object = struct { |
| 3156 | .value = try o.builder.string(std.mem.span(s)), | 3156 | .value = try o.builder.string(std.mem.span(s)), |
| 3157 | } }, &o.builder); | 3157 | } }, &o.builder); |
| 3158 | } | 3158 | } |
| 3159 | if (target.floatAbi() == .soft) { | 3159 | if (target.abi.float() == .soft) { |
| 3160 | // `use-soft-float` means "use software routines for floating point computations". In | 3160 | // `use-soft-float` means "use software routines for floating point computations". In |
| 3161 | // other words, it configures how LLVM lowers basic float instructions like `fcmp`, | 3161 | // other words, it configures how LLVM lowers basic float instructions like `fcmp`, |
| 3162 | // `fadd`, etc. The float calling convention is configured on `TargetMachine` and is | 3162 | // `fadd`, etc. The float calling convention is configured on `TargetMachine` and is |
| ... | @@ -4830,7 +4830,7 @@ pub const NavGen = struct { | ... | @@ -4830,7 +4830,7 @@ pub const NavGen = struct { |
| 4830 | const global_index = o.nav_map.get(nav_index).?; | 4830 | const global_index = o.nav_map.get(nav_index).?; |
| 4831 | 4831 | ||
| 4832 | const decl_name = decl_name: { | 4832 | const decl_name = decl_name: { |
| 4833 | if (zcu.getTarget().isWasm() and ty.zigTypeTag(zcu) == .@"fn") { | 4833 | if (zcu.getTarget().cpu.arch.isWasm() and ty.zigTypeTag(zcu) == .@"fn") { |
| 4834 | if (lib_name.toSlice(ip)) |lib_name_slice| { | 4834 | if (lib_name.toSlice(ip)) |lib_name_slice| { |
| 4835 | if (!std.mem.eql(u8, lib_name_slice, "c")) { | 4835 | if (!std.mem.eql(u8, lib_name_slice, "c")) { |
| 4836 | break :decl_name try o.builder.strtabStringFmt("{}|{s}", .{ nav.name.fmt(ip), lib_name_slice }); | 4836 | break :decl_name try o.builder.strtabStringFmt("{}|{s}", .{ nav.name.fmt(ip), lib_name_slice }); |
| ... | @@ -6567,7 +6567,7 @@ pub const FuncGen = struct { | ... | @@ -6567,7 +6567,7 @@ pub const FuncGen = struct { |
| 6567 | // Workaround for: | 6567 | // Workaround for: |
| 6568 | // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/lib/MC/WasmObjectWriter.cpp#L560 | 6568 | // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/lib/MC/WasmObjectWriter.cpp#L560 |
| 6569 | // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll | 6569 | // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll |
| 6570 | if (zcu.comp.getTarget().isWasm()) break :jmp_table null; | 6570 | if (zcu.comp.getTarget().cpu.arch.isWasm()) break :jmp_table null; |
| 6571 | 6571 | ||
| 6572 | // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just | 6572 | // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just |
| 6573 | // about acceptable - it won't fill L1d cache on most CPUs. | 6573 | // about acceptable - it won't fill L1d cache on most CPUs. |
| ... | @@ -10024,7 +10024,7 @@ pub const FuncGen = struct { | ... | @@ -10024,7 +10024,7 @@ pub const FuncGen = struct { |
| 10024 | // of the length. This means we need to emit a check where we skip the memset when the length | 10024 | // of the length. This means we need to emit a check where we skip the memset when the length |
| 10025 | // is 0 as we allow for undefined pointers in 0-sized slices. | 10025 | // is 0 as we allow for undefined pointers in 0-sized slices. |
| 10026 | // This logic can be removed once https://github.com/ziglang/zig/issues/16360 is done. | 10026 | // This logic can be removed once https://github.com/ziglang/zig/issues/16360 is done. |
| 10027 | const intrinsic_len0_traps = o.target.isWasm() and | 10027 | const intrinsic_len0_traps = o.target.cpu.arch.isWasm() and |
| 10028 | ptr_ty.isSlice(zcu) and | 10028 | ptr_ty.isSlice(zcu) and |
| 10029 | std.Target.wasm.featureSetHas(o.target.cpu.features, .bulk_memory); | 10029 | std.Target.wasm.featureSetHas(o.target.cpu.features, .bulk_memory); |
| 10030 | 10030 | ||
| ... | @@ -10181,7 +10181,7 @@ pub const FuncGen = struct { | ... | @@ -10181,7 +10181,7 @@ pub const FuncGen = struct { |
| 10181 | // For this reason we must add a check for 0-sized slices as its pointer field can be undefined. | 10181 | // For this reason we must add a check for 0-sized slices as its pointer field can be undefined. |
| 10182 | // We only have to do this for slices as arrays will have a valid pointer. | 10182 | // We only have to do this for slices as arrays will have a valid pointer. |
| 10183 | // This logic can be removed once https://github.com/ziglang/zig/issues/16360 is done. | 10183 | // This logic can be removed once https://github.com/ziglang/zig/issues/16360 is done. |
| 10184 | if (o.target.isWasm() and | 10184 | if (o.target.cpu.arch.isWasm() and |
| 10185 | std.Target.wasm.featureSetHas(o.target.cpu.features, .bulk_memory) and | 10185 | std.Target.wasm.featureSetHas(o.target.cpu.features, .bulk_memory) and |
| 10186 | dest_ptr_ty.isSlice(zcu)) | 10186 | dest_ptr_ty.isSlice(zcu)) |
| 10187 | { | 10187 | { |
| ... | @@ -12696,7 +12696,7 @@ fn backendSupportsF16(target: std.Target) bool { | ... | @@ -12696,7 +12696,7 @@ fn backendSupportsF16(target: std.Target) bool { |
| 12696 | .armeb, | 12696 | .armeb, |
| 12697 | .thumb, | 12697 | .thumb, |
| 12698 | .thumbeb, | 12698 | .thumbeb, |
| 12699 | => target.floatAbi() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8), | 12699 | => target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8), |
| 12700 | .aarch64, | 12700 | .aarch64, |
| 12701 | .aarch64_be, | 12701 | .aarch64_be, |
| 12702 | => std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8), | 12702 | => std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8), |
| ... | @@ -12723,7 +12723,7 @@ fn backendSupportsF128(target: std.Target) bool { | ... | @@ -12723,7 +12723,7 @@ fn backendSupportsF128(target: std.Target) bool { |
| 12723 | .armeb, | 12723 | .armeb, |
| 12724 | .thumb, | 12724 | .thumb, |
| 12725 | .thumbeb, | 12725 | .thumbeb, |
| 12726 | => target.floatAbi() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8), | 12726 | => target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8), |
| 12727 | .aarch64, | 12727 | .aarch64, |
| 12728 | .aarch64_be, | 12728 | .aarch64_be, |
| 12729 | => std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8), | 12729 | => std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8), |
src/libtsan.zig+6-6| ... | @@ -36,7 +36,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -36,7 +36,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 36 | .watchos => if (target.abi == .simulator) "clang_rt.tsan_watchossim_dynamic" else "clang_rt.tsan_watchos_dynamic", | 36 | .watchos => if (target.abi == .simulator) "clang_rt.tsan_watchossim_dynamic" else "clang_rt.tsan_watchos_dynamic", |
| 37 | else => "tsan", | 37 | else => "tsan", |
| 38 | }; | 38 | }; |
| 39 | const link_mode: std.builtin.LinkMode = if (target.isDarwin()) .dynamic else .static; | 39 | const link_mode: std.builtin.LinkMode = if (target.os.tag.isDarwin()) .dynamic else .static; |
| 40 | const output_mode = .Lib; | 40 | const output_mode = .Lib; |
| 41 | const basename = try std.zig.binNameAlloc(arena, .{ | 41 | const basename = try std.zig.binNameAlloc(arena, .{ |
| 42 | .root_name = root_name, | 42 | .root_name = root_name, |
| ... | @@ -52,9 +52,9 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -52,9 +52,9 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 52 | 52 | ||
| 53 | const optimize_mode = comp.compilerRtOptMode(); | 53 | const optimize_mode = comp.compilerRtOptMode(); |
| 54 | const strip = comp.compilerRtStrip(); | 54 | const strip = comp.compilerRtStrip(); |
| 55 | const link_libcpp = target.isDarwin(); | ||
| 56 | const unwind_tables: std.builtin.UnwindTables = | 55 | const unwind_tables: std.builtin.UnwindTables = |
| 57 | if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async"; | 56 | if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async"; |
| 57 | const link_libcpp = target.os.tag.isDarwin(); | ||
| 58 | 58 | ||
| 59 | const config = Compilation.Config.resolve(.{ | 59 | const config = Compilation.Config.resolve(.{ |
| 60 | .output_mode = output_mode, | 60 | .output_mode = output_mode, |
| ... | @@ -276,14 +276,14 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo | ... | @@ -276,14 +276,14 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 276 | }); | 276 | }); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | const skip_linker_dependencies = !target.isDarwin(); | 279 | const skip_linker_dependencies = !target.os.tag.isDarwin(); |
| 280 | const linker_allow_shlib_undefined = target.isDarwin(); | 280 | const linker_allow_shlib_undefined = target.os.tag.isDarwin(); |
| 281 | const install_name = if (target.isDarwin()) | 281 | const install_name = if (target.os.tag.isDarwin()) |
| 282 | try std.fmt.allocPrintZ(arena, "@rpath/{s}", .{basename}) | 282 | try std.fmt.allocPrintZ(arena, "@rpath/{s}", .{basename}) |
| 283 | else | 283 | else |
| 284 | null; | 284 | null; |
| 285 | // Workaround for https://github.com/llvm/llvm-project/issues/97627 | 285 | // Workaround for https://github.com/llvm/llvm-project/issues/97627 |
| 286 | const headerpad_size: ?u32 = if (target.isDarwin()) 32 else null; | 286 | const headerpad_size: ?u32 = if (target.os.tag.isDarwin()) 32 else null; |
| 287 | const sub_compilation = Compilation.create(comp.gpa, arena, .{ | 287 | const sub_compilation = Compilation.create(comp.gpa, arena, .{ |
| 288 | .local_cache_directory = comp.global_cache_directory, | 288 | .local_cache_directory = comp.global_cache_directory, |
| 289 | .global_cache_directory = comp.global_cache_directory, | 289 | .global_cache_directory = comp.global_cache_directory, |
src/libunwind.zig+1-1| ... | @@ -136,7 +136,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -136,7 +136,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 136 | if (!comp.config.any_non_single_threaded) { | 136 | if (!comp.config.any_non_single_threaded) { |
| 137 | try cflags.append("-D_LIBUNWIND_HAS_NO_THREADS"); | 137 | try cflags.append("-D_LIBUNWIND_HAS_NO_THREADS"); |
| 138 | } | 138 | } |
| 139 | if (target.cpu.arch.isArm() and target.abi.floatAbi() == .hard) { | 139 | if (target.cpu.arch.isArm() and target.abi.float() == .hard) { |
| 140 | try cflags.append("-DCOMPILER_RT_ARMHF_TARGET"); | 140 | try cflags.append("-DCOMPILER_RT_ARMHF_TARGET"); |
| 141 | } | 141 | } |
| 142 | try cflags.append("-Wno-bitwise-conditional-parentheses"); | 142 | try cflags.append("-Wno-bitwise-conditional-parentheses"); |
src/link.zig+2-2| ... | @@ -2067,7 +2067,7 @@ fn resolveLibInput( | ... | @@ -2067,7 +2067,7 @@ fn resolveLibInput( |
| 2067 | 2067 | ||
| 2068 | const lib_name = name_query.name; | 2068 | const lib_name = name_query.name; |
| 2069 | 2069 | ||
| 2070 | if (target.isDarwin() and link_mode == .dynamic) tbd: { | 2070 | if (target.os.tag.isDarwin() and link_mode == .dynamic) tbd: { |
| 2071 | // Prefer .tbd over .dylib. | 2071 | // Prefer .tbd over .dylib. |
| 2072 | const test_path: Path = .{ | 2072 | const test_path: Path = .{ |
| 2073 | .root_dir = lib_directory, | 2073 | .root_dir = lib_directory, |
| ... | @@ -2104,7 +2104,7 @@ fn resolveLibInput( | ... | @@ -2104,7 +2104,7 @@ fn resolveLibInput( |
| 2104 | 2104 | ||
| 2105 | // In the case of Darwin, the main check will be .dylib, so here we | 2105 | // In the case of Darwin, the main check will be .dylib, so here we |
| 2106 | // additionally check for .so files. | 2106 | // additionally check for .so files. |
| 2107 | if (target.isDarwin() and link_mode == .dynamic) so: { | 2107 | if (target.os.tag.isDarwin() and link_mode == .dynamic) so: { |
| 2108 | const test_path: Path = .{ | 2108 | const test_path: Path = .{ |
| 2109 | .root_dir = lib_directory, | 2109 | .root_dir = lib_directory, |
| 2110 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.so", .{lib_name}), | 2110 | .sub_path = try std.fmt.allocPrint(arena, "lib{s}.so", .{lib_name}), |
src/link/Coff.zig+1-1| ... | @@ -1881,7 +1881,7 @@ fn linkWithLLD(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: | ... | @@ -1881,7 +1881,7 @@ fn linkWithLLD(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: |
| 1881 | try argv.append(try allocPrint(arena, "-MLLVM:-target-abi={s}", .{mabi})); | 1881 | try argv.append(try allocPrint(arena, "-MLLVM:-target-abi={s}", .{mabi})); |
| 1882 | } | 1882 | } |
| 1883 | 1883 | ||
| 1884 | try argv.append(try allocPrint(arena, "-MLLVM:-float-abi={s}", .{if (target.abi.floatAbi() == .hard) "hard" else "soft"})); | 1884 | try argv.append(try allocPrint(arena, "-MLLVM:-float-abi={s}", .{if (target.abi.float() == .hard) "hard" else "soft"})); |
| 1885 | 1885 | ||
| 1886 | if (comp.config.lto != .none) { | 1886 | if (comp.config.lto != .none) { |
| 1887 | switch (optimize_mode) { | 1887 | switch (optimize_mode) { |
src/link/Elf.zig+2-2| ... | @@ -1709,7 +1709,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s | ... | @@ -1709,7 +1709,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 1709 | 1709 | ||
| 1710 | try argv.appendSlice(&.{ | 1710 | try argv.appendSlice(&.{ |
| 1711 | "-mllvm", | 1711 | "-mllvm", |
| 1712 | try std.fmt.allocPrint(arena, "-float-abi={s}", .{if (target.abi.floatAbi() == .hard) "hard" else "soft"}), | 1712 | try std.fmt.allocPrint(arena, "-float-abi={s}", .{if (target.abi.float() == .hard) "hard" else "soft"}), |
| 1713 | }); | 1713 | }); |
| 1714 | 1714 | ||
| 1715 | if (comp.config.lto != .none) { | 1715 | if (comp.config.lto != .none) { |
| ... | @@ -2053,7 +2053,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s | ... | @@ -2053,7 +2053,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 2053 | try argv.append(lib_path); | 2053 | try argv.append(lib_path); |
| 2054 | } | 2054 | } |
| 2055 | try argv.append(try comp.crtFileAsString(arena, "libc_nonshared.a")); | 2055 | try argv.append(try comp.crtFileAsString(arena, "libc_nonshared.a")); |
| 2056 | } else if (target.isMusl()) { | 2056 | } else if (target.abi.isMusl()) { |
| 2057 | try argv.append(try comp.crtFileAsString(arena, switch (link_mode) { | 2057 | try argv.append(try comp.crtFileAsString(arena, switch (link_mode) { |
| 2058 | .static => "libc.a", | 2058 | .static => "libc.a", |
| 2059 | .dynamic => "libc.so", | 2059 | .dynamic => "libc.so", |
src/link/MachO.zig+1-1| ... | @@ -3548,7 +3548,7 @@ pub fn getTarget(self: MachO) std.Target { | ... | @@ -3548,7 +3548,7 @@ pub fn getTarget(self: MachO) std.Target { |
| 3548 | pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void { | 3548 | pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void { |
| 3549 | const tracy = trace(@src()); | 3549 | const tracy = trace(@src()); |
| 3550 | defer tracy.end(); | 3550 | defer tracy.end(); |
| 3551 | if (builtin.target.isDarwin() and builtin.target.cpu.arch == .aarch64) { | 3551 | if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) { |
| 3552 | try dir.copyFile(sub_path, dir, sub_path, .{}); | 3552 | try dir.copyFile(sub_path, dir, sub_path, .{}); |
| 3553 | } | 3553 | } |
| 3554 | } | 3554 | } |
src/main.zig+1-1| ... | @@ -3983,7 +3983,7 @@ fn createModule( | ... | @@ -3983,7 +3983,7 @@ fn createModule( |
| 3983 | } | 3983 | } |
| 3984 | create_module.lib_dir_args = undefined; // From here we use lib_directories instead. | 3984 | create_module.lib_dir_args = undefined; // From here we use lib_directories instead. |
| 3985 | 3985 | ||
| 3986 | if (resolved_target.is_native_os and target.isDarwin()) { | 3986 | if (resolved_target.is_native_os and target.os.tag.isDarwin()) { |
| 3987 | // If we want to link against frameworks, we need system headers. | 3987 | // If we want to link against frameworks, we need system headers. |
| 3988 | if (create_module.frameworks.count() > 0) | 3988 | if (create_module.frameworks.count() > 0) |
| 3989 | create_module.want_native_include_dirs = true; | 3989 | create_module.want_native_include_dirs = true; |
src/target.zig+4-4| ... | @@ -12,7 +12,7 @@ pub const default_stack_protector_buffer_size = 4; | ... | @@ -12,7 +12,7 @@ pub const default_stack_protector_buffer_size = 4; |
| 12 | pub fn cannotDynamicLink(target: std.Target) bool { | 12 | pub fn cannotDynamicLink(target: std.Target) bool { |
| 13 | return switch (target.os.tag) { | 13 | return switch (target.os.tag) { |
| 14 | .freestanding => true, | 14 | .freestanding => true, |
| 15 | else => target.isSpirV(), | 15 | else => target.cpu.arch.isSpirV(), |
| 16 | }; | 16 | }; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| ... | @@ -40,12 +40,12 @@ pub fn libcNeedsLibUnwind(target: std.Target) bool { | ... | @@ -40,12 +40,12 @@ pub fn libcNeedsLibUnwind(target: std.Target) bool { |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | pub fn requiresPIE(target: std.Target) bool { | 42 | pub fn requiresPIE(target: std.Target) bool { |
| 43 | return target.isAndroid() or target.isDarwin() or target.os.tag == .openbsd; | 43 | return target.abi.isAndroid() or target.os.tag.isDarwin() or target.os.tag == .openbsd; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /// This function returns whether non-pic code is completely invalid on the given target. | 46 | /// This function returns whether non-pic code is completely invalid on the given target. |
| 47 | pub fn requiresPIC(target: std.Target, linking_libc: bool) bool { | 47 | pub fn requiresPIC(target: std.Target, linking_libc: bool) bool { |
| 48 | return target.isAndroid() or | 48 | return target.abi.isAndroid() or |
| 49 | target.os.tag == .windows or target.os.tag == .uefi or | 49 | target.os.tag == .windows or target.os.tag == .uefi or |
| 50 | osRequiresLibC(target) or | 50 | osRequiresLibC(target) or |
| 51 | (linking_libc and target.isGnuLibC()); | 51 | (linking_libc and target.isGnuLibC()); |
| ... | @@ -245,7 +245,7 @@ pub fn clangSupportsStackProtector(target: std.Target) bool { | ... | @@ -245,7 +245,7 @@ pub fn clangSupportsStackProtector(target: std.Target) bool { |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | pub fn libcProvidesStackProtector(target: std.Target) bool { | 247 | pub fn libcProvidesStackProtector(target: std.Target) bool { |
| 248 | return !target.isMinGW() and target.os.tag != .wasi and !target.isSpirV(); | 248 | return !target.isMinGW() and target.os.tag != .wasi and !target.cpu.arch.isSpirV(); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | pub fn supportsReturnAddress(target: std.Target) bool { | 251 | pub fn supportsReturnAddress(target: std.Target) bool { |
test/behavior/floatop.zig+2-2| ... | @@ -126,7 +126,7 @@ test "cmp f16" { | ... | @@ -126,7 +126,7 @@ test "cmp f16" { |
| 126 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | 126 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 127 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; | 127 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 128 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 128 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 129 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 129 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 130 | 130 | ||
| 131 | try testCmp(f16); | 131 | try testCmp(f16); |
| 132 | try comptime testCmp(f16); | 132 | try comptime testCmp(f16); |
| ... | @@ -135,7 +135,7 @@ test "cmp f16" { | ... | @@ -135,7 +135,7 @@ test "cmp f16" { |
| 135 | test "cmp f32/f64" { | 135 | test "cmp f32/f64" { |
| 136 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 136 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 137 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; | 137 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 138 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 138 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 139 | 139 | ||
| 140 | try testCmp(f32); | 140 | try testCmp(f32); |
| 141 | try comptime testCmp(f32); | 141 | try comptime testCmp(f32); |
test/behavior/math.zig+3-3| ... | @@ -1639,7 +1639,7 @@ test "NaN comparison" { | ... | @@ -1639,7 +1639,7 @@ test "NaN comparison" { |
| 1639 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1639 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1640 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; | 1640 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 1641 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 1641 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1642 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 1642 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 1643 | 1643 | ||
| 1644 | try testNanEqNan(f16); | 1644 | try testNanEqNan(f16); |
| 1645 | try testNanEqNan(f32); | 1645 | try testNanEqNan(f32); |
| ... | @@ -1795,7 +1795,7 @@ test "runtime comparison to NaN is comptime-known" { | ... | @@ -1795,7 +1795,7 @@ test "runtime comparison to NaN is comptime-known" { |
| 1795 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1795 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1796 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; | 1796 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 1797 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 1797 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1798 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 1798 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 1799 | 1799 | ||
| 1800 | const S = struct { | 1800 | const S = struct { |
| 1801 | fn doTheTest(comptime F: type, x: F) void { | 1801 | fn doTheTest(comptime F: type, x: F) void { |
| ... | @@ -1826,7 +1826,7 @@ test "runtime int comparison to inf is comptime-known" { | ... | @@ -1826,7 +1826,7 @@ test "runtime int comparison to inf is comptime-known" { |
| 1826 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1826 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1827 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; | 1827 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 1828 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 1828 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 1829 | if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 | 1829 | if (builtin.cpu.arch.isArm() and builtin.target.abi.float() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 |
| 1830 | 1830 | ||
| 1831 | const S = struct { | 1831 | const S = struct { |
| 1832 | fn doTheTest(comptime F: type, x: u32) void { | 1832 | fn doTheTest(comptime F: type, x: u32) void { |
test/c_abi/main.zig+4-4| ... | @@ -135,7 +135,7 @@ export fn zig_f64(x: f64) void { | ... | @@ -135,7 +135,7 @@ export fn zig_f64(x: f64) void { |
| 135 | expect(x == 56.78) catch @panic("test failure: zig_f64"); | 135 | expect(x == 56.78) catch @panic("test failure: zig_f64"); |
| 136 | } | 136 | } |
| 137 | export fn zig_longdouble(x: c_longdouble) void { | 137 | export fn zig_longdouble(x: c_longdouble) void { |
| 138 | if (!builtin.target.isWasm()) return; // waiting for #1481 | 138 | if (!builtin.target.cpu.arch.isWasm()) return; // waiting for #1481 |
| 139 | expect(x == 12.34) catch @panic("test failure: zig_longdouble"); | 139 | expect(x == 12.34) catch @panic("test failure: zig_longdouble"); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| ... | @@ -1661,7 +1661,7 @@ test "bool simd vector" { | ... | @@ -1661,7 +1661,7 @@ test "bool simd vector" { |
| 1661 | } | 1661 | } |
| 1662 | 1662 | ||
| 1663 | { | 1663 | { |
| 1664 | if (!builtin.target.isWasm()) c_vector_256_bool(.{ | 1664 | if (!builtin.target.cpu.arch.isWasm()) c_vector_256_bool(.{ |
| 1665 | false, | 1665 | false, |
| 1666 | true, | 1666 | true, |
| 1667 | true, | 1667 | true, |
| ... | @@ -2179,7 +2179,7 @@ test "bool simd vector" { | ... | @@ -2179,7 +2179,7 @@ test "bool simd vector" { |
| 2179 | try expect(vec[255] == false); | 2179 | try expect(vec[255] == false); |
| 2180 | } | 2180 | } |
| 2181 | { | 2181 | { |
| 2182 | if (!builtin.target.isWasm()) c_vector_512_bool(.{ | 2182 | if (!builtin.target.cpu.arch.isWasm()) c_vector_512_bool(.{ |
| 2183 | true, | 2183 | true, |
| 2184 | true, | 2184 | true, |
| 2185 | true, | 2185 | true, |
| ... | @@ -5593,7 +5593,7 @@ test "f80 extra struct" { | ... | @@ -5593,7 +5593,7 @@ test "f80 extra struct" { |
| 5593 | 5593 | ||
| 5594 | comptime { | 5594 | comptime { |
| 5595 | skip: { | 5595 | skip: { |
| 5596 | if (builtin.target.isWasm()) break :skip; | 5596 | if (builtin.target.cpu.arch.isWasm()) break :skip; |
| 5597 | 5597 | ||
| 5598 | _ = struct { | 5598 | _ = struct { |
| 5599 | export fn zig_f128(x: f128) f128 { | 5599 | export fn zig_f128(x: f128) f128 { |
test/standalone/stack_iterator/build.zig+2-2| ... | @@ -24,7 +24,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -24,7 +24,7 @@ pub fn build(b: *std.Build) void { |
| 24 | .root_source_file = b.path("unwind.zig"), | 24 | .root_source_file = b.path("unwind.zig"), |
| 25 | .target = target, | 25 | .target = target, |
| 26 | .optimize = optimize, | 26 | .optimize = optimize, |
| 27 | .unwind_tables = if (target.result.isDarwin()) .@"async" else null, | 27 | .unwind_tables = if (target.result.os.tag.isDarwin()) .@"async" else null, |
| 28 | .omit_frame_pointer = false, | 28 | .omit_frame_pointer = false, |
| 29 | }), | 29 | }), |
| 30 | }); | 30 | }); |
| ... | @@ -94,7 +94,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -94,7 +94,7 @@ pub fn build(b: *std.Build) void { |
| 94 | .root_source_file = b.path("shared_lib_unwind.zig"), | 94 | .root_source_file = b.path("shared_lib_unwind.zig"), |
| 95 | .target = target, | 95 | .target = target, |
| 96 | .optimize = optimize, | 96 | .optimize = optimize, |
| 97 | .unwind_tables = if (target.result.isDarwin()) .@"async" else null, | 97 | .unwind_tables = if (target.result.os.tag.isDarwin()) .@"async" else null, |
| 98 | .omit_frame_pointer = true, | 98 | .omit_frame_pointer = true, |
| 99 | }), | 99 | }), |
| 100 | }); | 100 | }); |
test/standalone/stack_iterator/shared_lib_unwind.zig+2-2| ... | @@ -36,8 +36,8 @@ extern fn frame0( | ... | @@ -36,8 +36,8 @@ extern fn frame0( |
| 36 | 36 | ||
| 37 | pub fn main() !void { | 37 | pub fn main() !void { |
| 38 | // Disabled until the DWARF unwinder bugs on .aarch64 are solved | 38 | // Disabled until the DWARF unwinder bugs on .aarch64 are solved |
| 39 | if (builtin.omit_frame_pointer and comptime builtin.target.isDarwin() and builtin.cpu.arch == .aarch64) return; | 39 | if (builtin.omit_frame_pointer and comptime builtin.target.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) return; |
| 40 | if (builtin.target.isDarwin() and builtin.cpu.arch == .x86_64) return; // https://github.com/ziglang/zig/issues/21337 | 40 | if (builtin.target.os.tag.isDarwin() and builtin.cpu.arch == .x86_64) return; // https://github.com/ziglang/zig/issues/21337 |
| 41 | 41 | ||
| 42 | if (!std.debug.have_ucontext or !std.debug.have_getcontext) return; | 42 | if (!std.debug.have_ucontext or !std.debug.have_getcontext) return; |
| 43 | 43 |
test/standalone/stack_iterator/unwind.zig+1-1| ... | @@ -88,7 +88,7 @@ noinline fn frame0(expected: *[4]usize, unwound: *[4]usize) void { | ... | @@ -88,7 +88,7 @@ noinline fn frame0(expected: *[4]usize, unwound: *[4]usize) void { |
| 88 | 88 | ||
| 89 | pub fn main() !void { | 89 | pub fn main() !void { |
| 90 | // Disabled until the DWARF unwinder bugs on .aarch64 are solved | 90 | // Disabled until the DWARF unwinder bugs on .aarch64 are solved |
| 91 | if (builtin.omit_frame_pointer and comptime builtin.target.isDarwin() and builtin.cpu.arch == .aarch64) return; | 91 | if (builtin.omit_frame_pointer and comptime builtin.target.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) return; |
| 92 | 92 | ||
| 93 | if (!std.debug.have_ucontext or !std.debug.have_getcontext) return; | 93 | if (!std.debug.have_ucontext or !std.debug.have_getcontext) return; |
| 94 | 94 |