Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b335ec9
Add a special case for CStr/CString in the improper_ctypes lint
Flying-Toast Mar 23, 2024
f6767f7
Detect `*` operator on `!Sized` expression
estebank Jul 31, 2024
f62b9e0
rustc: Simplify getting sysroot library directory
petrochenkov Jul 30, 2024
5e6c87d
Port std library to RTEMS
thesummer Aug 21, 2023
d28690d
rtems: Add spec file for arm_rtems6_eabihf
thesummer Jan 23, 2024
f83ddb5
Add documentation for target armv7-rtems-eabihf
thesummer Jun 26, 2024
4c5e888
rustdoc: show exact case-sensitive matches first
lolbinarycat Aug 22, 2024
b968b26
Put Pin::as_deref_mut in impl Pin<Ptr>
coolreader18 Aug 22, 2024
c65ef3d
Move into_inner_unchecked back to the bottom of the impl block
coolreader18 Aug 23, 2024
62f7d53
Update `compiler_builtins` to `0.1.121`
scottmcm Aug 23, 2024
5c6285c
Add myself to the review rotation for libs
thomcc Aug 23, 2024
5cef88c
Print the generic parameter along with the variance in dumps.
cjgillot Aug 22, 2024
9ccd7ab
library: Move unstable API of new_uninit to new features
workingjubilee Aug 22, 2024
90b4e17
CI: rfl: move to temporary commit
ojeda Aug 23, 2024
3415198
Rollup merge of #127021 - thesummer:1-add-target-support-for-rtems-ar…
workingjubilee Aug 24, 2024
1a70ad1
Rollup merge of #128467 - estebank:unsized-args, r=cjgillot
workingjubilee Aug 24, 2024
8423a2a
Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillot
workingjubilee Aug 24, 2024
94d0725
Rollup merge of #129416 - workingjubilee:partial-move-from-stabilizat…
workingjubilee Aug 24, 2024
eb8d76c
Rollup merge of #129418 - petrochenkov:libsearch2, r=jieyouxu
workingjubilee Aug 24, 2024
15a7043
Rollup merge of #129429 - cjgillot:named-variance, r=compiler-errors
workingjubilee Aug 24, 2024
25a3c88
Rollup merge of #129430 - lolbinarycat:rustdoc-search-exact-case, r=n…
workingjubilee Aug 24, 2024
81707e5
Rollup merge of #129449 - coolreader18:pin-as_deref_mut-signature, r=…
workingjubilee Aug 24, 2024
3442ec7
Rollup merge of #129481 - scottmcm:update-cb, r=tgross35
workingjubilee Aug 24, 2024
d482191
Rollup merge of #129482 - thomcc:add-to-review-rotation, r=jieyouxu
workingjubilee Aug 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,11 +1317,9 @@ fn link_sanitizer_runtime(
name: &str,
) {
fn find_sanitizer_runtime(sess: &Session, filename: &str) -> PathBuf {
let session_tlib =
filesearch::make_target_lib_path(&sess.sysroot, sess.opts.target_triple.triple());
let path = session_tlib.join(filename);
let path = sess.target_tlib_path.dir.join(filename);
if path.exists() {
return session_tlib;
return sess.target_tlib_path.dir.clone();
} else {
let default_sysroot =
filesearch::get_or_default_sysroot().expect("Failed finding sysroot");
Expand Down Expand Up @@ -1612,19 +1610,18 @@ fn print_native_static_libs(
}

fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> PathBuf {
let fs = sess.target_filesearch(PathKind::Native);
let file_path = fs.get_lib_path().join(name);
let file_path = sess.target_tlib_path.dir.join(name);
if file_path.exists() {
return file_path;
}
// Special directory with objects used only in self-contained linkage mode
if self_contained {
let file_path = fs.get_self_contained_lib_path().join(name);
let file_path = sess.target_tlib_path.dir.join("self-contained").join(name);
if file_path.exists() {
return file_path;
}
}
for search_path in fs.search_paths() {
for search_path in sess.target_filesearch(PathKind::Native).search_paths() {
let file_path = search_path.dir.join(name);
if file_path.exists() {
return file_path;
Expand Down Expand Up @@ -2131,7 +2128,7 @@ fn add_library_search_dirs(
| LinkSelfContainedComponents::UNWIND
| LinkSelfContainedComponents::MINGW,
) {
let lib_path = sess.target_filesearch(PathKind::Native).get_self_contained_lib_path();
let lib_path = sess.target_tlib_path.dir.join("self-contained");
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}

Expand All @@ -2146,8 +2143,7 @@ fn add_library_search_dirs(
|| sess.target.os == "fuchsia"
|| sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
{
let lib_path = sess.target_filesearch(PathKind::Native).get_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
cmd.include_path(&fix_windows_verbatim_for_gcc(&sess.target_tlib_path.dir));
}

// Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks
Expand Down Expand Up @@ -2859,15 +2855,14 @@ fn add_upstream_native_libraries(
//
// The returned path will always have `fix_windows_verbatim_for_gcc()` applied to it.
fn rehome_sysroot_lib_dir(sess: &Session, lib_dir: &Path) -> PathBuf {
let sysroot_lib_path = sess.target_filesearch(PathKind::All).get_lib_path();
let sysroot_lib_path = &sess.target_tlib_path.dir;
let canonical_sysroot_lib_path =
{ try_canonicalize(&sysroot_lib_path).unwrap_or_else(|_| sysroot_lib_path.clone()) };
{ try_canonicalize(sysroot_lib_path).unwrap_or_else(|_| sysroot_lib_path.clone()) };

let canonical_lib_dir = try_canonicalize(lib_dir).unwrap_or_else(|_| lib_dir.to_path_buf());
if canonical_lib_dir == canonical_sysroot_lib_path {
// This path, returned by `target_filesearch().get_lib_path()`, has
// already had `fix_windows_verbatim_for_gcc()` applied if needed.
sysroot_lib_path
// This path already had `fix_windows_verbatim_for_gcc()` applied if needed.
sysroot_lib_path.clone()
} else {
fix_windows_verbatim_for_gcc(lib_dir)
}
Expand Down
16 changes: 1 addition & 15 deletions compiler/rustc_session/src/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ use std::{env, fs};

use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use smallvec::{smallvec, SmallVec};
use tracing::debug;

use crate::search_paths::{PathKind, SearchPath};

#[derive(Clone)]
pub struct FileSearch<'a> {
sysroot: &'a Path,
triple: &'a str,
cli_search_paths: &'a [SearchPath],
tlib_path: &'a SearchPath,
kind: PathKind,
Expand All @@ -32,23 +29,12 @@ impl<'a> FileSearch<'a> {
.chain(std::iter::once(self.tlib_path))
}

pub fn get_lib_path(&self) -> PathBuf {
make_target_lib_path(self.sysroot, self.triple)
}

pub fn get_self_contained_lib_path(&self) -> PathBuf {
self.get_lib_path().join("self-contained")
}

pub fn new(
sysroot: &'a Path,
triple: &'a str,
cli_search_paths: &'a [SearchPath],
tlib_path: &'a SearchPath,
kind: PathKind,
) -> FileSearch<'a> {
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
FileSearch { sysroot, triple, cli_search_paths, tlib_path, kind }
FileSearch { cli_search_paths, tlib_path, kind }
}
}

Expand Down
16 changes: 2 additions & 14 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,22 +439,10 @@ impl Session {
}

pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
&self.sysroot,
self.opts.target_triple.triple(),
&self.opts.search_paths,
&self.target_tlib_path,
kind,
)
filesearch::FileSearch::new(&self.opts.search_paths, &self.target_tlib_path, kind)
}
pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> {
filesearch::FileSearch::new(
&self.sysroot,
config::host_triple(),
&self.opts.search_paths,
&self.host_tlib_path,
kind,
)
filesearch::FileSearch::new(&self.opts.search_paths, &self.host_tlib_path, kind)
}

/// Returns a list of directories where target-specific tool binaries are located. Some fallback
Expand Down