aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-07-13 22:58:25 +0200
committerJakub Konka <kubkon@jakubkonka.com>2021-07-15 18:49:47 +0200
commite3575cdad44e63f598b557ba3142675197875906 (patch)
tree000783a9e8eb1feb1a77aebfa458a0d52e200723 /src/Compilation.zig
parent398672eb30dce08bd3370cde7adeb503c64a4892 (diff)
downloadzig-e3575cdad44e63f598b557ba3142675197875906.tar.gz
zig-e3575cdad44e63f598b557ba3142675197875906.zip
zld: decommision use_lld for MachO
Invoke `linkAsArchive` directly in MachO backend when LLVM is available and we are asked to create a static lib.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 625de58c63..5146e757fa 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -866,6 +866,10 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
// Make a decision on whether to use LLD or our own linker.
const use_lld = options.use_lld orelse blk: {
+ if (options.target.isDarwin()) {
+ break :blk false;
+ }
+
if (!build_options.have_llvm)
break :blk false;
@@ -903,11 +907,9 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
break :blk false;
};
- const darwin_can_use_system_sdk =
- // comptime conditions
- ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
- // runtime conditions
- (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
+ const darwin_can_use_system_sdk = comptime std.Target.current.isDarwin() and
+ std.builtin.os.tag == .macos and
+ options.target.isDarwin();
const sysroot = blk: {
if (options.sysroot) |sysroot| {
@@ -924,10 +926,10 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
const lto = blk: {
if (options.want_lto) |explicit| {
- if (!use_lld)
+ if (!use_lld and !options.target.isDarwin())
return error.LtoUnavailableWithoutLld;
break :blk explicit;
- } else if (!use_lld) {
+ } else if (!use_lld and !options.target.isDarwin()) {
break :blk false;
} else if (options.c_source_files.len == 0) {
break :blk false;