mirror of
https://github.com/ziglang/zig.git
synced 2026-01-19 05:45:12 +00:00
Return an error when macOS ABI is not {none, simulator, macabi}
This commit is contained in:
parent
f8a1a2c4a1
commit
e306d04473
@ -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()) {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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| {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user