diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-10-18 00:23:35 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-10-23 16:27:38 -0700 |
| commit | 5ca54036ca0bc292ead681c03c8ac57e27a127db (patch) | |
| tree | 17b151d68b2cb40c49d82af85286074be929db7d /src/target.zig | |
| parent | 2dcfa723767d284cef5eb180be7c080583ddbe25 (diff) | |
| download | zig-5ca54036ca0bc292ead681c03c8ac57e27a127db.tar.gz zig-5ca54036ca0bc292ead681c03c8ac57e27a127db.zip | |
move linker input file parsing to the compilation pipeline
Diffstat (limited to 'src/target.zig')
| -rw-r--r-- | src/target.zig | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/src/target.zig b/src/target.zig index 7d30781f43..8e0b90cd82 100644 --- a/src/target.zig +++ b/src/target.zig @@ -1,4 +1,6 @@ const std = @import("std"); +const assert = std.debug.assert; + const Type = @import("Type.zig"); const AddressSpace = std.builtin.AddressSpace; const Alignment = @import("InternPool.zig").Alignment; @@ -284,40 +286,17 @@ pub fn hasRedZone(target: std.Target) bool { pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { // The linking order of these is significant and should match the order other // c compilers such as gcc or clang use. - return switch (target.os.tag) { - .netbsd, .openbsd => &[_][]const u8{ - "-lm", - "-lpthread", - "-lc", - "-lutil", - }, - .solaris, .illumos => &[_][]const u8{ - "-lm", - "-lsocket", - "-lnsl", - // Solaris releases after 10 merged the threading libraries into libc. - "-lc", - }, - .haiku => &[_][]const u8{ - "-lm", - "-lroot", - "-lpthread", - "-lc", - "-lnetwork", - }, - else => if (target.isAndroid() or target.abi.isOpenHarmony()) &[_][]const u8{ - "-lm", - "-lc", - "-ldl", - } else &[_][]const u8{ - "-lm", - "-lpthread", - "-lc", - "-ldl", - "-lrt", - "-lutil", - }, + const result: []const []const u8 = switch (target.os.tag) { + .netbsd, .openbsd => &.{ "-lm", "-lpthread", "-lc", "-lutil" }, + // Solaris releases after 10 merged the threading libraries into libc. + .solaris, .illumos => &.{ "-lm", "-lsocket", "-lnsl", "-lc" }, + .haiku => &.{ "-lm", "-lroot", "-lpthread", "-lc", "-lnetwork" }, + else => if (target.isAndroid() or target.abi.isOpenHarmony()) + &.{ "-lm", "-lc", "-ldl" } + else + &.{ "-lm", "-lpthread", "-lc", "-ldl", "-lrt", "-lutil" }, }; + return result; } pub fn clangMightShellOutForAssembly(target: std.Target) bool { |
