Commit e306d04473
Changed files (3)
src
src/codegen/llvm.zig
@@ -86,6 +86,9 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
.spirv64 => return error.@"LLVM backend does not support SPIR-V",
};
+ var arena = std.heap.ArenaAllocator.init(allocator);
+ defer arena.deinit();
+
const llvm_os = blk: {
if (target.os.tag.isDarwin()) {
const min_version = target.os.version_range.semver.min;
@@ -96,7 +99,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
.watchos => "watchos",
else => unreachable,
};
- break :blk try std.fmt.allocPrintZ(allocator, "{s}{d}.{d}.{d}", .{
+ break :blk try std.fmt.allocPrintZ(arena.allocator(), "{s}{d}.{d}.{d}", .{
llvm_os,
min_version.major,
min_version.minor,
src/link/MachO/Dylib.zig
@@ -305,6 +305,7 @@ const TargetMatcher = struct {
const abi: ?[]const u8 = switch (target.abi) {
.none => null,
.simulator => "simulator",
+ .macabi => "maccatalyst",
else => unreachable,
};
if (abi) |x| {
src/Compilation.zig
@@ -1719,6 +1719,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
const have_bin_emit = comp.bin_file.options.emit != null or comp.whole_bin_sub_path != null;
if (have_bin_emit and !comp.bin_file.options.skip_linker_dependencies) {
+ if (comp.getTarget().isDarwin()) {
+ switch (comp.getTarget().abi) {
+ .none,
+ .simulator,
+ .macabi,
+ => {},
+ else => return error.LibCUnavailable,
+ }
+ }
// If we need to build glibc for the target, add work items for it.
// We go through the work queue so that building can be done in parallel.
if (comp.wantBuildGLibCFromSource()) {