diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libc_installation.zig | 13 | ||||
| -rw-r--r-- | src/main.zig | 16 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/libc_installation.zig b/src/libc_installation.zig index facb16257e..0901194dd8 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -41,7 +41,7 @@ pub const LibCInstallation = struct { pub fn parse( allocator: Allocator, libc_file: []const u8, - target: std.Target.Query, + target: std.Target, ) !LibCInstallation { var self: LibCInstallation = .{}; @@ -95,24 +95,23 @@ pub const LibCInstallation = struct { return error.ParseError; } - const os_tag = target.getOsTag(); + const os_tag = target.os.tag; if (self.crt_dir == null and !target.isDarwin()) { log.err("crt_dir may not be empty for {s}\n", .{@tagName(os_tag)}); return error.ParseError; } - const abi = target.getAbi(); - if (self.msvc_lib_dir == null and target.isWindows() and abi == .msvc) { + if (self.msvc_lib_dir == null and os_tag == .windows and target.abi == .msvc) { log.err("msvc_lib_dir may not be empty for {s}-{s}\n", .{ @tagName(os_tag), - @tagName(abi), + @tagName(target.abi), }); return error.ParseError; } - if (self.kernel32_lib_dir == null and target.isWindows() and abi == .msvc) { + if (self.kernel32_lib_dir == null and os_tag == .windows and target.abi == .msvc) { log.err("kernel32_lib_dir may not be empty for {s}-{s}\n", .{ @tagName(os_tag), - @tagName(abi), + @tagName(target.abi), }); return error.ParseError; } diff --git a/src/main.zig b/src/main.zig index 716be60763..3abe6ed3e4 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2696,13 +2696,13 @@ fn buildOutputType( } if (use_lld) |opt| { - if (opt and target_query.isDarwin()) { + if (opt and target.isDarwin()) { fatal("LLD requested with Mach-O object format. Only the self-hosted linker is supported for this target.", .{}); } } if (want_lto) |opt| { - if (opt and target_query.isDarwin()) { + if (opt and target.isDarwin()) { fatal("LTO is not yet supported with the Mach-O object format. More details: https://github.com/ziglang/zig/issues/8680", .{}); } } @@ -2772,7 +2772,7 @@ fn buildOutputType( var libc_installation: ?LibCInstallation = null; if (libc_paths_file) |paths_file| { - libc_installation = LibCInstallation.parse(arena, paths_file, target_query) catch |err| { + libc_installation = LibCInstallation.parse(arena, paths_file, target) catch |err| { fatal("unable to parse libc paths file at path {s}: {s}", .{ paths_file, @errorName(err) }); }; } @@ -2865,7 +2865,7 @@ fn buildOutputType( libc_installation = try LibCInstallation.findNative(.{ .allocator = arena, .verbose = true, - .target = target_query.toTarget(), + .target = target, }); try lib_dirs.appendSlice(&.{ libc_installation.?.msvc_lib_dir.?, libc_installation.?.kernel32_lib_dir.? }); @@ -4755,6 +4755,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { const target_query = try parseTargetQueryOrReportFatalError(gpa, .{ .arch_os_abi = target_arch_os_abi, }); + const target = try std.zig.system.resolveTargetQuery(target_query); if (print_includes) { var arena_state = std.heap.ArenaAllocator.init(gpa); @@ -4764,7 +4765,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { const libc_installation: ?*LibCInstallation = libc: { if (input_file) |libc_file| { const libc = try arena.create(LibCInstallation); - libc.* = LibCInstallation.parse(arena, libc_file, target_query) catch |err| { + libc.* = LibCInstallation.parse(arena, libc_file, target) catch |err| { fatal("unable to parse libc file at path {s}: {s}", .{ libc_file, @errorName(err) }); }; break :libc libc; @@ -4779,7 +4780,6 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { }; defer zig_lib_directory.handle.close(); - const target = target_query.toTarget(); const is_native_abi = target_query.isNativeAbi(); const libc_dirs = Compilation.detectLibCIncludeDirs( @@ -4810,7 +4810,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { } if (input_file) |libc_file| { - var libc = LibCInstallation.parse(gpa, libc_file, target_query) catch |err| { + var libc = LibCInstallation.parse(gpa, libc_file, target) catch |err| { fatal("unable to parse libc file at path {s}: {s}", .{ libc_file, @errorName(err) }); }; defer libc.deinit(gpa); @@ -4821,7 +4821,7 @@ pub fn cmdLibC(gpa: Allocator, args: []const []const u8) !void { var libc = LibCInstallation.findNative(.{ .allocator = gpa, .verbose = true, - .target = try std.zig.system.resolveTargetQuery(target_query), + .target = target, }) catch |err| { fatal("unable to detect native libc: {s}", .{@errorName(err)}); }; |
