| ... | @@ -1643,20 +1643,19 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { | ... | @@ -1643,20 +1643,19 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1643 | if (self.base.options.link_libcpp) { | 1643 | if (self.base.options.link_libcpp) { |
| 1644 | try argv.append(comp.libcxxabi_static_lib.?.full_object_path); | 1644 | try argv.append(comp.libcxxabi_static_lib.?.full_object_path); |
| 1645 | try argv.append(comp.libcxx_static_lib.?.full_object_path); | 1645 | try argv.append(comp.libcxx_static_lib.?.full_object_path); |
| | 1646 | if (target_util.libcNeedsLibUnwind(target)) { |
| | 1647 | try argv.append(comp.libunwind_static_lib.?.full_object_path); |
| | 1648 | } |
| 1646 | } | 1649 | } |
| 1647 | | 1650 | |
| 1648 | // libc dep | 1651 | // libc dep |
| 1649 | if (self.base.options.link_libc) { | 1652 | if (self.base.options.link_libc) { |
| 1650 | if (self.base.options.libc_installation != null) { | 1653 | if (self.base.options.libc_installation != null) { |
| 1651 | if (target_util.libcNeedsLibUnwind(target)) { | | |
| 1652 | try argv.append(comp.libunwind_static_lib.?.full_object_path); | | |
| 1653 | } | | |
| 1654 | const needs_grouping = self.base.options.link_mode == .Static; | 1654 | const needs_grouping = self.base.options.link_mode == .Static; |
| 1655 | if (needs_grouping) try argv.append("--start-group"); | 1655 | if (needs_grouping) try argv.append("--start-group"); |
| 1656 | try argv.appendSlice(target_util.libcFullLinkFlags(target)); | 1656 | try argv.appendSlice(target_util.libcFullLinkFlags(target)); |
| 1657 | if (needs_grouping) try argv.append("--end-group"); | 1657 | if (needs_grouping) try argv.append("--end-group"); |
| 1658 | } else if (target.isGnuLibC()) { | 1658 | } else if (target.isGnuLibC()) { |
| 1659 | try argv.append(comp.libunwind_static_lib.?.full_object_path); | | |
| 1660 | for (glibc.libs) |lib| { | 1659 | for (glibc.libs) |lib| { |
| 1661 | const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ | 1660 | const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ |
| 1662 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, | 1661 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| ... | @@ -1665,13 +1664,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { | ... | @@ -1665,13 +1664,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1665 | } | 1664 | } |
| 1666 | try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a")); | 1665 | try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a")); |
| 1667 | } else if (target.isMusl()) { | 1666 | } else if (target.isMusl()) { |
| 1668 | try argv.append(comp.libunwind_static_lib.?.full_object_path); | | |
| 1669 | try argv.append(try comp.get_libc_crt_file(arena, switch (self.base.options.link_mode) { | 1667 | try argv.append(try comp.get_libc_crt_file(arena, switch (self.base.options.link_mode) { |
| 1670 | .Static => "libc.a", | 1668 | .Static => "libc.a", |
| 1671 | .Dynamic => "libc.so", | 1669 | .Dynamic => "libc.so", |
| 1672 | })); | 1670 | })); |
| 1673 | } else if (self.base.options.link_libcpp) { | | |
| 1674 | try argv.append(comp.libunwind_static_lib.?.full_object_path); | | |
| 1675 | } else { | 1671 | } else { |
| 1676 | unreachable; // Compiler was supposed to emit an error for not being able to provide libc. | 1672 | unreachable; // Compiler was supposed to emit an error for not being able to provide libc. |
| 1677 | } | 1673 | } |