From 007422cc04226730234f352925a028f651fcd23a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 17 Oct 2011 10:41:22 -0700 Subject: [PATCH] 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. --- src/comp/back/link.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index 8dd812f87429..f5f51436d871 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, " "));