about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-10-17 10:41:22 -0700
committerBrian Anderson <banderson@mozilla.com>2011-10-17 10:41:22 -0700
commit007422cc04226730234f352925a028f651fcd23a (patch)
treed462b61c41492e33c51eeca1698fd06c0171e091 /src/comp
parentb42e551285541a1634b0e5fd731109f74a4f9ef7 (diff)
downloadrust-007422cc04226730234f352925a028f651fcd23a.tar.gz
rust-007422cc04226730234f352925a028f651fcd23a.zip
Change the linkage order on linux and add -ldl
-lrt and -ldl need to be specified after -lrustrt since they are only used by
rustrt.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/back/link.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 8dd812f8742..f5f51436d87 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -582,15 +582,16 @@ fn link_binary(sess: session::session,
         gcc_args += ["-lm", main];
     }
 
-    // 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"];
 
+    // On linux librt and libdl are an indirect dependencies via rustrt,
+    // and binutils 2.22+ won't add them automatically
+    if sess.get_targ_cfg().os == session::os_linux {
+        gcc_args += ["-lrt", "-ldl"];
+    }
+
     gcc_args += rpath::get_rpath_flags(sess, saved_out_filename);
 
     log #fmt("gcc link args: %s", str::connect(gcc_args, " "));