aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-05-12 22:39:10 +0200
committerAndrew Kelley <andrew@ziglang.org>2021-05-13 00:44:56 -0400
commit459c9f05359e3405f39e4c954c62c61a493e49ae (patch)
treebbb88d1dd59b9699f1f58f948412fc63f694695e /src/target.zig
parent799d1f0d36f69c8aead5184a76f87b557d690d7b (diff)
downloadzig-459c9f05359e3405f39e4c954c62c61a493e49ae.tar.gz
zig-459c9f05359e3405f39e4c954c62c61a493e49ae.zip
stage2: fix build on OpenBSD/NetBSD
Apparently these systems do not provide libdl or librt.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index 1e31f99dc1..c2018db012 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -374,3 +374,24 @@ pub fn hasRedZone(target: std.Target) bool {
else => false,
};
}
+
+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",
+ },
+ else => &[_][]const u8{
+ "-lm",
+ "-lpthread",
+ "-lc",
+ "-ldl",
+ "-lrt",
+ "-lutil",
+ },
+ };
+}