about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-10-16 02:36:42 -0700
committerBrian Anderson <banderson@mozilla.com>2011-10-16 02:36:42 -0700
commitb42e551285541a1634b0e5fd731109f74a4f9ef7 (patch)
tree5f54ed8953006e5d895e59eeaa3c073fdbc978c6 /src/comp
parentad5014bf4c81fdfd6c382d2f2df1e9f824787dde (diff)
downloadrust-b42e551285541a1634b0e5fd731109f74a4f9ef7.tar.gz
rust-b42e551285541a1634b0e5fd731109f74a4f9ef7.zip
Only link librt on linux
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/back/link.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 2162e67724e..8dd812f8742 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -582,7 +582,14 @@ fn link_binary(sess: session::session,
         gcc_args += ["-lm", main];
     }
 
-    gcc_args += ["-lrustrt", "-lrt"];
+    // On linux librt is an indirect dependency via rustrt,
+    // and binutils 2.22+ won't add it automatically
+    if sess.get_targ_cfg().os == session::os_linux {
+        gcc_args += ["-lrt"];
+    }
+
+    // Always want the runtime linked in
+    gcc_args += ["-lrustrt"];
 
     gcc_args += rpath::get_rpath_flags(sess, saved_out_filename);