Call the target libdir target libdir
Because it's the target libdir. `--print` uses the same terminology, and it's a simple way to make it obviously different from `$sysroot/lib`.
This commit is contained in:
parent
db034cee00
commit
f42fb43517
@ -91,8 +91,8 @@ fn run(self, builder: &Builder<'_>) {
|
||||
// We skip populating the sysroot in non-zero stage because that'll lead
|
||||
// to rlib/rmeta conflicts if std gets built during this session.
|
||||
if compiler.stage == 0 {
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
|
||||
let libdir = builder.sysroot_target_libdir(compiler, target);
|
||||
let hostdir = builder.sysroot_target_libdir(compiler, compiler.host);
|
||||
add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
|
||||
}
|
||||
drop(_guard);
|
||||
@ -257,8 +257,8 @@ fn run(self, builder: &Builder<'_>) {
|
||||
false,
|
||||
);
|
||||
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
|
||||
let libdir = builder.sysroot_target_libdir(compiler, target);
|
||||
let hostdir = builder.sysroot_target_libdir(compiler, compiler.host);
|
||||
add_to_sysroot(builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target));
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
.join("bin");
|
||||
if src_sysroot_bin.exists() {
|
||||
let target_sysroot_bin =
|
||||
builder.sysroot_libdir(compiler, target).parent().unwrap().join("bin");
|
||||
builder.sysroot_target_libdir(compiler, target).parent().unwrap().join("bin");
|
||||
t!(fs::create_dir_all(&target_sysroot_bin));
|
||||
builder.cp_link_r(&src_sysroot_bin, &target_sysroot_bin);
|
||||
}
|
||||
@ -334,7 +334,7 @@ fn copy_third_party_objects(
|
||||
&& (target.contains("linux") || target.contains("fuchsia"))
|
||||
{
|
||||
let libunwind_path =
|
||||
copy_llvm_libunwind(builder, target, &builder.sysroot_libdir(*compiler, target));
|
||||
copy_llvm_libunwind(builder, target, &builder.sysroot_target_libdir(*compiler, target));
|
||||
target_deps.push((libunwind_path, DependencyType::Target));
|
||||
}
|
||||
|
||||
@ -347,7 +347,8 @@ fn copy_self_contained_objects(
|
||||
compiler: &Compiler,
|
||||
target: TargetSelection,
|
||||
) -> Vec<(PathBuf, DependencyType)> {
|
||||
let libdir_self_contained = builder.sysroot_libdir(*compiler, target).join("self-contained");
|
||||
let libdir_self_contained =
|
||||
builder.sysroot_target_libdir(*compiler, target).join("self-contained");
|
||||
t!(fs::create_dir_all(&libdir_self_contained));
|
||||
let mut target_deps = vec![];
|
||||
|
||||
@ -655,8 +656,8 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let hostdir = sysroot.join(lib).join("rustlib").join(compiler.host).join("lib");
|
||||
(libdir, hostdir)
|
||||
} else {
|
||||
let libdir = builder.sysroot_libdir(target_compiler, target);
|
||||
let hostdir = builder.sysroot_libdir(target_compiler, compiler.host);
|
||||
let libdir = builder.sysroot_target_libdir(target_compiler, target);
|
||||
let hostdir = builder.sysroot_target_libdir(target_compiler, compiler.host);
|
||||
(libdir, hostdir)
|
||||
};
|
||||
|
||||
@ -723,7 +724,7 @@ fn copy_sanitizers(
|
||||
}
|
||||
|
||||
let mut target_deps = Vec::new();
|
||||
let libdir = builder.sysroot_libdir(*compiler, target);
|
||||
let libdir = builder.sysroot_target_libdir(*compiler, target);
|
||||
|
||||
for runtime in &runtimes {
|
||||
let dst = libdir.join(&runtime.name);
|
||||
@ -801,7 +802,7 @@ fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> {
|
||||
|
||||
let src_dir = &builder.src.join("library").join("rtstartup");
|
||||
let dst_dir = &builder.native_dir(target).join("rtstartup");
|
||||
let sysroot_dir = &builder.sysroot_libdir(for_compiler, target);
|
||||
let sysroot_dir = &builder.sysroot_target_libdir(for_compiler, target);
|
||||
t!(fs::create_dir_all(dst_dir));
|
||||
|
||||
for file in &["rsbegin", "rsend"] {
|
||||
@ -1287,10 +1288,17 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
|
||||
}
|
||||
}
|
||||
|
||||
/// `RustcLink` copies all of the rlibs from the rustc build into the previous stage's sysroot.
|
||||
/// This is necessary for tools using `rustc_private`, where the previous compiler will build
|
||||
/// a tool against the next compiler.
|
||||
/// To build a tool against a compiler, the rlibs of that compiler that it links against
|
||||
/// must be in the sysroot of the compiler that's doing the compiling.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
struct RustcLink {
|
||||
/// The compiler whose rlibs we are copying around.
|
||||
pub compiler: Compiler,
|
||||
pub target_compiler: Compiler,
|
||||
/// This is the compiler into whose sysroot we want to copy the rlibs into.
|
||||
pub previous_stage_compiler: Compiler,
|
||||
pub target: TargetSelection,
|
||||
/// Not actually used; only present to make sure the cache invalidation is correct.
|
||||
crates: Vec<String>,
|
||||
@ -1300,7 +1308,7 @@ impl RustcLink {
|
||||
fn from_rustc(rustc: Rustc, host_compiler: Compiler) -> Self {
|
||||
Self {
|
||||
compiler: host_compiler,
|
||||
target_compiler: rustc.compiler,
|
||||
previous_stage_compiler: rustc.compiler,
|
||||
target: rustc.target,
|
||||
crates: rustc.crates,
|
||||
}
|
||||
@ -1317,12 +1325,12 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
/// Same as `std_link`, only for librustc
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let compiler = self.compiler;
|
||||
let target_compiler = self.target_compiler;
|
||||
let previous_stage_compiler = self.previous_stage_compiler;
|
||||
let target = self.target;
|
||||
add_to_sysroot(
|
||||
builder,
|
||||
&builder.sysroot_libdir(target_compiler, target),
|
||||
&builder.sysroot_libdir(target_compiler, compiler.host),
|
||||
&builder.sysroot_target_libdir(previous_stage_compiler, target),
|
||||
&builder.sysroot_target_libdir(previous_stage_compiler, compiler.host),
|
||||
&librustc_stamp(builder, compiler, target),
|
||||
);
|
||||
}
|
||||
@ -1770,7 +1778,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
|
||||
|
||||
// We prepend this bin directory to the user PATH when linking Rust binaries. To
|
||||
// avoid shadowing the system LLD we rename the LLD we provide to `rust-lld`.
|
||||
let libdir = builder.sysroot_libdir(target_compiler, target_compiler.host);
|
||||
let libdir = builder.sysroot_target_libdir(target_compiler, target_compiler.host);
|
||||
let libdir_bin = libdir.parent().unwrap().join("bin");
|
||||
t!(fs::create_dir_all(&libdir_bin));
|
||||
|
||||
@ -1854,8 +1862,9 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
|
||||
if let Some(enzyme_install) = enzyme_install {
|
||||
let lib_ext = std::env::consts::DLL_EXTENSION;
|
||||
let src_lib = enzyme_install.join("build/Enzyme/libEnzyme-19").with_extension(lib_ext);
|
||||
let libdir = builder.sysroot_libdir(build_compiler, build_compiler.host);
|
||||
let target_libdir = builder.sysroot_libdir(target_compiler, target_compiler.host);
|
||||
let libdir = builder.sysroot_target_libdir(build_compiler, build_compiler.host);
|
||||
let target_libdir =
|
||||
builder.sysroot_target_libdir(target_compiler, target_compiler.host);
|
||||
let dst_lib = libdir.join("libEnzyme-19").with_extension(lib_ext);
|
||||
let target_dst_lib = target_libdir.join("libEnzyme-19").with_extension(lib_ext);
|
||||
builder.copy_link(&src_lib, &dst_lib);
|
||||
@ -1923,7 +1932,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
|
||||
let sysroot = builder.sysroot(target_compiler);
|
||||
let rustc_libdir = builder.rustc_libdir(target_compiler);
|
||||
t!(fs::create_dir_all(&rustc_libdir));
|
||||
let src_libdir = builder.sysroot_libdir(build_compiler, host);
|
||||
let src_libdir = builder.sysroot_target_libdir(build_compiler, host);
|
||||
for f in builder.read_dir(&src_libdir) {
|
||||
let filename = f.file_name().into_string().unwrap();
|
||||
|
||||
|
@ -459,7 +459,8 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
|
||||
|
||||
// Copy over lld if it's there
|
||||
if builder.config.lld_enabled {
|
||||
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
|
||||
let src_dir =
|
||||
builder.sysroot_target_libdir(compiler, host).parent().unwrap().join("bin");
|
||||
let rust_lld = exe("rust-lld", compiler.host);
|
||||
builder.copy_link(&src_dir.join(&rust_lld), &dst_dir.join(&rust_lld));
|
||||
let self_contained_lld_src_dir = src_dir.join("gcc-ld");
|
||||
@ -474,7 +475,8 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
|
||||
}
|
||||
}
|
||||
if builder.tool_enabled("wasm-component-ld") {
|
||||
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
|
||||
let src_dir =
|
||||
builder.sysroot_target_libdir(compiler, host).parent().unwrap().join("bin");
|
||||
let ld = exe("wasm-component-ld", compiler.host);
|
||||
builder.copy_link(&src_dir.join(&ld), &dst_dir.join(&ld));
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
.arg(builder.src.join("src/librustdoc/html/static/css/rustdoc.css").to_str().unwrap())
|
||||
.env("RUSTC_STAGE", self.compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
|
||||
.env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))
|
||||
.env("RUSTDOC_LIBDIR", builder.sysroot_target_libdir(self.compiler, self.compiler.host))
|
||||
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
|
||||
.env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
|
||||
.env("RUSTC_BOOTSTRAP", "1");
|
||||
@ -1722,7 +1722,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
// of them!
|
||||
|
||||
cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler));
|
||||
cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target));
|
||||
cmd.arg("--run-lib-path").arg(builder.sysroot_target_libdir(compiler, target));
|
||||
cmd.arg("--rustc-path").arg(builder.rustc(compiler));
|
||||
|
||||
// Minicore auxiliary lib for `no_core` tests that need `core` stubs in cross-compilation
|
||||
@ -2583,7 +2583,7 @@ fn prepare_cargo_test(
|
||||
// by `Cargo::new` and that actually makes things go wrong.
|
||||
if builder.kind != Kind::Miri {
|
||||
let mut dylib_path = dylib_path();
|
||||
dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
|
||||
dylib_path.insert(0, PathBuf::from(&*builder.sysroot_target_libdir(compiler, target)));
|
||||
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
}
|
||||
|
||||
@ -2818,7 +2818,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let libdir = if builder.download_rustc() {
|
||||
builder.rustc_libdir(compiler)
|
||||
} else {
|
||||
builder.sysroot_libdir(compiler, target).to_path_buf()
|
||||
builder.sysroot_target_libdir(compiler, target).to_path_buf()
|
||||
};
|
||||
let mut dylib_path = dylib_path();
|
||||
dylib_path.insert(0, PathBuf::from(&*libdir));
|
||||
@ -2943,7 +2943,7 @@ fn run(self, builder: &Builder<'_>) {
|
||||
cmd.run(builder);
|
||||
|
||||
// Push all our dylibs to the emulator
|
||||
for f in t!(builder.sysroot_libdir(compiler, target).read_dir()) {
|
||||
for f in t!(builder.sysroot_target_libdir(compiler, target).read_dir()) {
|
||||
let f = t!(f);
|
||||
let name = f.file_name().into_string().unwrap();
|
||||
if helpers::is_dylib(&name) {
|
||||
|
@ -466,7 +466,7 @@ pub fn command(builder: &Builder<'_>) -> BootstrapCommand {
|
||||
let compiler = builder.compiler_for(builder.top_stage, host, host);
|
||||
let mut cmd = command(builder.ensure(ErrorIndex { compiler }));
|
||||
let mut dylib_paths = builder.rustc_lib_paths(compiler);
|
||||
dylib_paths.push(PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host)));
|
||||
dylib_paths.push(PathBuf::from(&builder.sysroot_target_libdir(compiler, compiler.host)));
|
||||
add_dylib_path(dylib_paths, &mut cmd);
|
||||
cmd
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ pub fn sysroot(&self, compiler: Compiler) -> PathBuf {
|
||||
|
||||
/// Returns the libdir where the standard library and other artifacts are
|
||||
/// found for a compiler's sysroot.
|
||||
pub fn sysroot_libdir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {
|
||||
pub fn sysroot_target_libdir(&self, compiler: Compiler, target: TargetSelection) -> PathBuf {
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
struct Libdir {
|
||||
compiler: Compiler,
|
||||
@ -1211,7 +1211,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
|
||||
}
|
||||
|
||||
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf {
|
||||
self.sysroot_libdir(compiler, compiler.host).with_file_name("codegen-backends")
|
||||
self.sysroot_target_libdir(compiler, compiler.host).with_file_name("codegen-backends")
|
||||
}
|
||||
|
||||
/// Returns the compiler's libdir where it stores the dynamic libraries that
|
||||
|
Loading…
Reference in New Issue
Block a user