Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {

const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
const opts: DarwinOptions = if (use_lld and options.is_native_os and options.target.isDarwin()) inner: {
const syslibroot = try std.zig.system.getSDKPath(arena);
// TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
// See https://github.com/ziglang/zig/issues/6996
const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
break :inner .{
.syslibroot = syslibroot,
Expand Down
2 changes: 2 additions & 0 deletions src/link/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
man.hash.addStringSet(self.base.options.system_libs);
man.hash.add(allow_shlib_undefined);
man.hash.add(self.base.options.bind_global_refs_locally);
man.hash.add(self.base.options.system_linker_hack);
man.hash.addOptionalBytes(self.base.options.syslibroot);

// We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
_ = try man.hit();
Expand Down