@@ -1317,11 +1317,9 @@ fn link_sanitizer_runtime(
1317
1317
name: &str,
1318
1318
) {
1319
1319
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);
1323
1321
if path.exists() {
1324
- return session_tlib ;
1322
+ return sess.target_tlib_path.dir.clone() ;
1325
1323
} else {
1326
1324
let default_sysroot =
1327
1325
filesearch::get_or_default_sysroot().expect("Failed finding sysroot");
@@ -1612,19 +1610,18 @@ fn print_native_static_libs(
1612
1610
}
1613
1611
1614
1612
fn 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);
1617
1614
if file_path.exists() {
1618
1615
return file_path;
1619
1616
}
1620
1617
// Special directory with objects used only in self-contained linkage mode
1621
1618
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);
1623
1620
if file_path.exists() {
1624
1621
return file_path;
1625
1622
}
1626
1623
}
1627
- for search_path in fs .search_paths() {
1624
+ for search_path in sess.target_filesearch(PathKind::Native) .search_paths() {
1628
1625
let file_path = search_path.dir.join(name);
1629
1626
if file_path.exists() {
1630
1627
return file_path;
@@ -2131,7 +2128,7 @@ fn add_library_search_dirs(
2131
2128
| LinkSelfContainedComponents::UNWIND
2132
2129
| LinkSelfContainedComponents::MINGW,
2133
2130
) {
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" );
2135
2132
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
2136
2133
}
2137
2134
@@ -2146,8 +2143,7 @@ fn add_library_search_dirs(
2146
2143
|| sess.target.os == "fuchsia"
2147
2144
|| sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
2148
2145
{
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));
2151
2147
}
2152
2148
2153
2149
// Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks
@@ -2859,15 +2855,14 @@ fn add_upstream_native_libraries(
2859
2855
//
2860
2856
// The returned path will always have `fix_windows_verbatim_for_gcc()` applied to it.
2861
2857
fn 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 ;
2863
2859
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()) };
2865
2861
2866
2862
let canonical_lib_dir = try_canonicalize(lib_dir).unwrap_or_else(|_| lib_dir.to_path_buf());
2867
2863
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()
2871
2866
} else {
2872
2867
fix_windows_verbatim_for_gcc(lib_dir)
2873
2868
}
0 commit comments