@@ -1317,11 +1317,9 @@ fn link_sanitizer_runtime(
13171317    name :  & str , 
13181318)  { 
13191319    fn  find_sanitizer_runtime ( sess :  & Session ,  filename :  & str )  -> PathBuf  { 
1320-         let  session_tlib =
1321-             filesearch:: make_target_lib_path ( & sess. sysroot ,  sess. opts . target_triple . triple ( ) ) ; 
1322-         let  path = session_tlib. join ( filename) ; 
1320+         let  path = sess. target_tlib_path . dir . join ( filename) ; 
13231321        if  path. exists ( )  { 
1324-             return  session_tlib ; 
1322+             return  sess . target_tlib_path . dir . clone ( ) ; 
13251323        }  else  { 
13261324            let  default_sysroot =
13271325                filesearch:: get_or_default_sysroot ( ) . expect ( "Failed finding sysroot" ) ; 
@@ -1612,19 +1610,18 @@ fn print_native_static_libs(
16121610} 
16131611
16141612fn  get_object_file_path ( sess :  & Session ,  name :  & str ,  self_contained :  bool )  -> PathBuf  { 
1615-     let  fs = sess. target_filesearch ( PathKind :: Native ) ; 
1616-     let  file_path = fs. get_lib_path ( ) . join ( name) ; 
1613+     let  file_path = sess. target_tlib_path . dir . join ( name) ; 
16171614    if  file_path. exists ( )  { 
16181615        return  file_path; 
16191616    } 
16201617    // Special directory with objects used only in self-contained linkage mode 
16211618    if  self_contained { 
1622-         let  file_path = fs . get_self_contained_lib_path ( ) . join ( name) ; 
1619+         let  file_path = sess . target_tlib_path . dir . join ( "self-contained" ) . join ( name) ; 
16231620        if  file_path. exists ( )  { 
16241621            return  file_path; 
16251622        } 
16261623    } 
1627-     for  search_path in  fs . search_paths ( )  { 
1624+     for  search_path in  sess . target_filesearch ( PathKind :: Native ) . search_paths ( )  { 
16281625        let  file_path = search_path. dir . join ( name) ; 
16291626        if  file_path. exists ( )  { 
16301627            return  file_path; 
@@ -2131,7 +2128,7 @@ fn add_library_search_dirs(
21312128            | LinkSelfContainedComponents :: UNWIND 
21322129            | LinkSelfContainedComponents :: MINGW , 
21332130    )  { 
2134-         let  lib_path = sess. target_filesearch ( PathKind :: Native ) . get_self_contained_lib_path ( ) ; 
2131+         let  lib_path = sess. target_tlib_path . dir . join ( "self-contained" ) ; 
21352132        cmd. include_path ( & fix_windows_verbatim_for_gcc ( & lib_path) ) ; 
21362133    } 
21372134
@@ -2146,8 +2143,7 @@ fn add_library_search_dirs(
21462143        || sess. target . os  == "fuchsia" 
21472144        || sess. target . is_like_osx  && !sess. opts . unstable_opts . sanitizer . is_empty ( ) 
21482145    { 
2149-         let  lib_path = sess. target_filesearch ( PathKind :: Native ) . get_lib_path ( ) ; 
2150-         cmd. include_path ( & fix_windows_verbatim_for_gcc ( & lib_path) ) ; 
2146+         cmd. include_path ( & fix_windows_verbatim_for_gcc ( & sess. target_tlib_path . dir ) ) ; 
21512147    } 
21522148
21532149    // Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks 
@@ -2859,15 +2855,14 @@ fn add_upstream_native_libraries(
28592855// 
28602856// The returned path will always have `fix_windows_verbatim_for_gcc()` applied to it. 
28612857fn  rehome_sysroot_lib_dir ( sess :  & Session ,  lib_dir :  & Path )  -> PathBuf  { 
2862-     let  sysroot_lib_path = sess. target_filesearch ( PathKind :: All ) . get_lib_path ( ) ; 
2858+     let  sysroot_lib_path = & sess. target_tlib_path . dir ; 
28632859    let  canonical_sysroot_lib_path =
2864-         {  try_canonicalize ( & sysroot_lib_path) . unwrap_or_else ( |_| sysroot_lib_path. clone ( ) )  } ; 
2860+         {  try_canonicalize ( sysroot_lib_path) . unwrap_or_else ( |_| sysroot_lib_path. clone ( ) )  } ; 
28652861
28662862    let  canonical_lib_dir = try_canonicalize ( lib_dir) . unwrap_or_else ( |_| lib_dir. to_path_buf ( ) ) ; 
28672863    if  canonical_lib_dir == canonical_sysroot_lib_path { 
2868-         // This path, returned by `target_filesearch().get_lib_path()`, has 
2869-         // already had `fix_windows_verbatim_for_gcc()` applied if needed. 
2870-         sysroot_lib_path
2864+         // This path already had `fix_windows_verbatim_for_gcc()` applied if needed. 
2865+         sysroot_lib_path. clone ( ) 
28712866    }  else  { 
28722867        fix_windows_verbatim_for_gcc ( lib_dir) 
28732868    } 
0 commit comments