@@ -20,17 +20,30 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
20
20
let sysroot = sess. filesearch ( ) . sysroot ( ) ;
21
21
let output = out_filename;
22
22
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
+
23
27
let target_triple = sess. get_opts ( ) . target_triple ;
24
28
let rpaths = get_rpaths ( cwd, sysroot, output, libs, target_triple) ;
25
29
rpaths_to_flags ( rpaths) ;
26
- [ ] // FIXME: activate RPATH!
30
+ [ ] // FIXME: Activate RPATH!
27
31
}
28
32
29
33
#[ cfg( target_os="win32" ) ]
30
34
fn get_rpath_flags ( _sess : session:: session , _out_filename : str ) -> [ str ] {
31
35
[ ]
32
36
}
33
37
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
+
34
47
fn rpaths_to_flags ( rpaths : [ str ] ) -> [ str ] {
35
48
vec:: map ( { |rpath| #fmt ( "-Wl,-rpath,%s" , rpath) } , rpaths)
36
49
}
0 commit comments