| author | |
| committer | |
| log | 459c9f05359e3405f39e4c954c62c61a493e49ae |
| tree | bbb88d1dd59b9699f1f58f948412fc63f694695e |
| parent | 799d1f0d36f69c8aead5184a76f87b557d690d7b |
Apparently these systems do not provide libdl or librt.2 files changed, 22 insertions(+), 9 deletions(-)
src/link/Elf.zig+1-9| ... | ... | @@ -1650,15 +1650,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1650 | 1650 | if (self.base.options.libc_installation != null) { |
| 1651 | 1651 | const needs_grouping = self.base.options.link_mode == .Static; |
| 1652 | 1652 | if (needs_grouping) try argv.append("--start-group"); |
| 1653 | // This matches the order of glibc.libs | |
| 1654 | try argv.appendSlice(&[_][]const u8{ | |
| 1655 | "-lm", | |
| 1656 | "-lpthread", | |
| 1657 | "-lc", | |
| 1658 | "-ldl", | |
| 1659 | "-lrt", | |
| 1660 | "-lutil", | |
| 1661 | }); | |
| 1653 | try argv.appendSlice(target_util.libcFullLinkFlags(target)); | |
| 1662 | 1654 | if (needs_grouping) try argv.append("--end-group"); |
| 1663 | 1655 | } else if (target.isGnuLibC()) { |
| 1664 | 1656 | try argv.append(comp.libunwind_static_lib.?.full_object_path); |
src/target.zig+21| ... | ... | @@ -374,3 +374,24 @@ pub fn hasRedZone(target: std.Target) bool { |
| 374 | 374 | else => false, |
| 375 | 375 | }; |
| 376 | 376 | } |
| 377 | ||
| 378 | pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { | |
| 379 | // The linking order of these is significant and should match the order other | |
| 380 | // c compilers such as gcc or clang use. | |
| 381 | return switch (target.os.tag) { | |
| 382 | .netbsd, .openbsd => &[_][]const u8{ | |
| 383 | "-lm", | |
| 384 | "-lpthread", | |
| 385 | "-lc", | |
| 386 | "-lutil", | |
| 387 | }, | |
| 388 | else => &[_][]const u8{ | |
| 389 | "-lm", | |
| 390 | "-lpthread", | |
| 391 | "-lc", | |
| 392 | "-ldl", | |
| 393 | "-lrt", | |
| 394 | "-lutil", | |
| 395 | }, | |
| 396 | }; | |
| 397 | } |