diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-04 23:12:46 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-05 16:21:55 -0700 |
| commit | 2f340a4d3dd2472800401ca23285c26d2ebcfcf5 (patch) | |
| tree | 94af823f39dc23487521b5114af418ea0c63c0c3 /src/comp | |
| parent | 3d5471f6ab90c1e0904c6f7eb34b01d2603534bc (diff) | |
| download | rust-2f340a4d3dd2472800401ca23285c26d2ebcfcf5.tar.gz rust-2f340a4d3dd2472800401ca23285c26d2ebcfcf5.zip | |
rpath the path to the runtime
We don't currently rpath native libs, but we do know where rustrt is located and everything needs to link to it.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/back/rpath.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/comp/back/rpath.rs b/src/comp/back/rpath.rs index 3e6fab37919..a2513649e94 100644 --- a/src/comp/back/rpath.rs +++ b/src/comp/back/rpath.rs @@ -20,10 +20,14 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] { let sysroot = sess.filesearch().sysroot(); let output = out_filename; let libs = cstore::get_used_crate_files(sess.get_cstore()); + // We don't currently rpath native libraries, but we know + // where rustrt is and we know every rust program needs it + let libs = libs + [get_sysroot_absolute_rt_lib(sess)]; + let target_triple = sess.get_opts().target_triple; let rpaths = get_rpaths(cwd, sysroot, output, libs, target_triple); rpaths_to_flags(rpaths); - [] // FIXME: activate RPATH! + [] // FIXME: Activate RPATH! } #[cfg(target_os="win32")] @@ -31,6 +35,15 @@ fn get_rpath_flags(_sess: session::session, _out_filename: str) -> [str] { [] } +fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path { + let path = [sess.filesearch().sysroot()] + + filesearch::relative_target_lib_path( + sess.get_opts().target_triple) + + [os::dylib_filename("rustrt")]; + check vec::is_not_empty(path); + fs::connect_many(path) +} + fn rpaths_to_flags(rpaths: [str]) -> [str] { vec::map({ |rpath| #fmt("-Wl,-rpath,%s",rpath)}, rpaths) } |
