File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1122,6 +1122,19 @@ fn add_upstream_rust_crates(cmd: &mut Linker,
1122
1122
cnum : CrateNum ) {
1123
1123
let src = sess. cstore . used_crate_source ( cnum) ;
1124
1124
let cratepath = & src. rlib . unwrap ( ) . 0 ;
1125
+
1126
+ if sess. target . target . options . is_like_osx {
1127
+ // On Apple platforms, the sanitizer is always built as a dylib, and
1128
+ // LLVM will link to `@rpath/*.dylib`, so we need to specify an
1129
+ // rpath to the library as well (the rpath should be absolute, see
1130
+ // PR #41352 for details).
1131
+ //
1132
+ // FIXME: Remove this logic into librustc_*san once Cargo supports it
1133
+ let rpath = cratepath. parent ( ) . unwrap ( ) ;
1134
+ let rpath = rpath. to_str ( ) . expect ( "non-utf8 component in path" ) ;
1135
+ cmd. args ( & [ "-Wl,-rpath" . into ( ) , "-Xlinker" . into ( ) , rpath. into ( ) ] ) ;
1136
+ }
1137
+
1125
1138
let dst = tmpdir. join ( cratepath. file_name ( ) . unwrap ( ) ) ;
1126
1139
let cfg = archive_config ( sess, & dst, Some ( cratepath) ) ;
1127
1140
let mut archive = ArchiveBuilder :: new ( cfg) ;
You can’t perform that action at this time.
0 commit comments