authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-05-20 16:54:52+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-05-22 17:45:07+02:00
loge306d04473818ac8b58779aa1ff20b12edb8e94a
tree44d01d290362c86b4b0c1b0208636727ea8095e3
parentf8a1a2c4a18a2a5f274029c4c59f3a8e83f36b6b

Return an error when macOS ABI is not {none, simulator, macabi}


3 files changed, 14 insertions(+), 1 deletions(-)

src/Compilation.zig+9
......@@ -1719,6 +1719,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
17191719 const have_bin_emit = comp.bin_file.options.emit != null or comp.whole_bin_sub_path != null;
17201720
17211721 if (have_bin_emit and !comp.bin_file.options.skip_linker_dependencies) {
1722 if (comp.getTarget().isDarwin()) {
1723 switch (comp.getTarget().abi) {
1724 .none,
1725 .simulator,
1726 .macabi,
1727 => {},
1728 else => return error.LibCUnavailable,
1729 }
1730 }
17221731 // If we need to build glibc for the target, add work items for it.
17231732 // We go through the work queue so that building can be done in parallel.
17241733 if (comp.wantBuildGLibCFromSource()) {
src/codegen/llvm.zig+4-1
......@@ -86,6 +86,9 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
8686 .spirv64 => return error.@"LLVM backend does not support SPIR-V",
8787 };
8888
89 var arena = std.heap.ArenaAllocator.init(allocator);
90 defer arena.deinit();
91
8992 const llvm_os = blk: {
9093 if (target.os.tag.isDarwin()) {
9194 const min_version = target.os.version_range.semver.min;
......@@ -96,7 +99,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
9699 .watchos => "watchos",
97100 else => unreachable,
98101 };
99 break :blk try std.fmt.allocPrintZ(allocator, "{s}{d}.{d}.{d}", .{
102 break :blk try std.fmt.allocPrintZ(arena.allocator(), "{s}{d}.{d}.{d}", .{
100103 llvm_os,
101104 min_version.major,
102105 min_version.minor,
src/link/MachO/Dylib.zig+1
......@@ -305,6 +305,7 @@ const TargetMatcher = struct {
305305 const abi: ?[]const u8 = switch (target.abi) {
306306 .none => null,
307307 .simulator => "simulator",
308 .macabi => "maccatalyst",
308309 else => unreachable,
309310 };
310311 if (abi) |x| {