Skip to content

Commit b2bb7ef

Browse files
committed
---
yaml --- r: 5700 b: refs/heads/master c: 2f340a4 h: refs/heads/master v: v3
1 parent 6ab7dd0 commit b2bb7ef

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3d5471f6ab90c1e0904c6f7eb34b01d2603534bc
2+
refs/heads/master: 2f340a4d3dd2472800401ca23285c26d2ebcfcf5

trunk/src/comp/back/rpath.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,30 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
2020
let sysroot = sess.filesearch().sysroot();
2121
let output = out_filename;
2222
let libs = cstore::get_used_crate_files(sess.get_cstore());
23+
// We don't currently rpath native libraries, but we know
24+
// where rustrt is and we know every rust program needs it
25+
let libs = libs + [get_sysroot_absolute_rt_lib(sess)];
26+
2327
let target_triple = sess.get_opts().target_triple;
2428
let rpaths = get_rpaths(cwd, sysroot, output, libs, target_triple);
2529
rpaths_to_flags(rpaths);
26-
[] // FIXME: activate RPATH!
30+
[] // FIXME: Activate RPATH!
2731
}
2832

2933
#[cfg(target_os="win32")]
3034
fn get_rpath_flags(_sess: session::session, _out_filename: str) -> [str] {
3135
[]
3236
}
3337

38+
fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path {
39+
let path = [sess.filesearch().sysroot()]
40+
+ filesearch::relative_target_lib_path(
41+
sess.get_opts().target_triple)
42+
+ [os::dylib_filename("rustrt")];
43+
check vec::is_not_empty(path);
44+
fs::connect_many(path)
45+
}
46+
3447
fn rpaths_to_flags(rpaths: [str]) -> [str] {
3548
vec::map({ |rpath| #fmt("-Wl,-rpath,%s",rpath)}, rpaths)
3649
}

0 commit comments

Comments
 (0)