| ... | ... | @@ -633,13 +633,15 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 633 | 633 | if (!mem.eql(u8, the_object_path, full_out_path)) { |
| 634 | 634 | try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{}); |
| 635 | 635 | } |
| 636 | | } else { |
| 636 | } else outer: { |
| 637 | 637 | const use_zld = blk: { |
| 638 | 638 | if (self.base.options.is_native_os and self.base.options.system_linker_hack) { |
| 639 | // If the user forces the use of ld64, make sure we are running native! |
| 639 | 640 | break :blk false; |
| 640 | 641 | } |
| 641 | 642 | |
| 642 | 643 | if (self.base.options.target.cpu.arch == .aarch64) { |
| 644 | // On aarch64, always use zld. |
| 643 | 645 | break :blk true; |
| 644 | 646 | } |
| 645 | 647 | |
| ... | ... | @@ -647,6 +649,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 647 | 649 | self.base.options.output_mode == .Lib or |
| 648 | 650 | self.base.options.linker_script != null) |
| 649 | 651 | { |
| 652 | // Fallback to LLD in this handful of cases on x86_64 only. |
| 650 | 653 | break :blk false; |
| 651 | 654 | } |
| 652 | 655 | |
| ... | ... | @@ -674,7 +677,28 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 674 | 677 | try input_files.append(comp.libcxxabi_static_lib.?.full_object_path); |
| 675 | 678 | try input_files.append(comp.libcxx_static_lib.?.full_object_path); |
| 676 | 679 | } |
| 677 | | return zld.link(input_files.items, full_out_path); |
| 680 | |
| 681 | if (self.base.options.verbose_link) { |
| 682 | var argv = std.ArrayList([]const u8).init(self.base.allocator); |
| 683 | defer argv.deinit(); |
| 684 | |
| 685 | try argv.append("zig"); |
| 686 | try argv.append("ld"); |
| 687 | |
| 688 | try argv.ensureCapacity(input_files.items.len); |
| 689 | for (input_files.items) |f| { |
| 690 | argv.appendAssumeCapacity(f); |
| 691 | } |
| 692 | |
| 693 | try argv.append("-o"); |
| 694 | try argv.append(full_out_path); |
| 695 | |
| 696 | Compilation.dump_argv(argv.items); |
| 697 | } |
| 698 | |
| 699 | try zld.link(input_files.items, full_out_path); |
| 700 | |
| 701 | break :outer; |
| 678 | 702 | } |
| 679 | 703 | |
| 680 | 704 | // Create an LLD command line and invoke it. |