@@ -922,28 +922,20 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
922
922
. map ( |channel| format ! ( "-{}" , channel) )
923
923
. unwrap_or_default ( ) ;
924
924
925
- match sess. opts . target_triple . triple ( ) {
926
- "aarch64-apple-darwin" | "x86_64-apple-darwin" => {
927
- // On Apple platforms, the sanitizer is always built as a dylib, and
928
- // LLVM will link to `@rpath/*.dylib`, so we need to specify an
929
- // rpath to the library as well (the rpath should be absolute, see
930
- // PR #41352 for details).
931
- let filename = format ! ( "rustc{}_rt.{}" , channel, name) ;
932
- let path = find_sanitizer_runtime ( & sess, & filename) ;
933
- let rpath = path. to_str ( ) . expect ( "non-utf8 component in path" ) ;
934
- linker. args ( & [ "-Wl,-rpath" , "-Xlinker" , rpath] ) ;
935
- linker. link_dylib ( Symbol :: intern ( & filename) ) ;
936
- }
937
- "aarch64-fuchsia"
938
- | "aarch64-unknown-linux-gnu"
939
- | "x86_64-fuchsia"
940
- | "x86_64-unknown-freebsd"
941
- | "x86_64-unknown-linux-gnu" => {
942
- let filename = format ! ( "librustc{}_rt.{}.a" , channel, name) ;
943
- let path = find_sanitizer_runtime ( & sess, & filename) . join ( & filename) ;
944
- linker. link_whole_rlib ( & path) ;
945
- }
946
- _ => { }
925
+ if sess. target . is_like_osx {
926
+ // On Apple platforms, the sanitizer is always built as a dylib, and
927
+ // LLVM will link to `@rpath/*.dylib`, so we need to specify an
928
+ // rpath to the library as well (the rpath should be absolute, see
929
+ // PR #41352 for details).
930
+ let filename = format ! ( "rustc{}_rt.{}" , channel, name) ;
931
+ let path = find_sanitizer_runtime ( & sess, & filename) ;
932
+ let rpath = path. to_str ( ) . expect ( "non-utf8 component in path" ) ;
933
+ linker. args ( & [ "-Wl,-rpath" , "-Xlinker" , rpath] ) ;
934
+ linker. link_dylib ( Symbol :: intern ( & filename) ) ;
935
+ } else {
936
+ let filename = format ! ( "librustc{}_rt.{}.a" , channel, name) ;
937
+ let path = find_sanitizer_runtime ( & sess, & filename) . join ( & filename) ;
938
+ linker. link_whole_rlib ( & path) ;
947
939
}
948
940
}
949
941
0 commit comments