Skip to content

Commit 61972e7

Browse files
committed
Rollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton
rustc: Move location of `codegen-backends` dir Right now this directory is located under: ``` $sysroot/lib/rustlib/$target/lib/codegen-backends ``` but after seeing what we do in a few other places it seems that a more appropriate location would be: ``` $sysroot/lib/rustlib/$target/codegen-backends ``` so this commit moves it!
2 parents 68135d1 + 8ebe542 commit 61972e7

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/bootstrap/builder.rs

+5
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ impl<'a> Builder<'a> {
377377
self.ensure(Libdir { compiler, target })
378378
}
379379

380+
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf {
381+
self.sysroot_libdir(compiler, compiler.host)
382+
.with_file_name("codegen-backends")
383+
}
384+
380385
/// Returns the compiler's libdir where it stores the dynamic libraries that
381386
/// it itself links against.
382387
///

src/bootstrap/compile.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
724724
//
725725
// Here we're looking for the output dylib of the `CodegenBackend` step and
726726
// we're copying that into the `codegen-backends` folder.
727-
let libdir = builder.sysroot_libdir(target_compiler, target);
728-
let dst = libdir.join("codegen-backends");
727+
let dst = builder.sysroot_codegen_backends(target_compiler);
729728
t!(fs::create_dir_all(&dst));
730729

731730
for backend in builder.config.rust_codegen_backends.iter() {

src/bootstrap/dist.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,9 @@ impl Step for Rustc {
435435
}
436436

437437
// Copy over the codegen backends
438-
let backends_src = builder.sysroot_libdir(compiler, host)
439-
.join("codegen-backends");
440-
let backends_dst = image.join("lib/rustlib")
441-
.join(&*host)
442-
.join("lib/codegen-backends");
438+
let backends_src = builder.sysroot_codegen_backends(compiler);
439+
let backends_rel = backends_src.strip_prefix(&src).unwrap();
440+
let backends_dst = image.join(&backends_rel);
443441
t!(fs::create_dir_all(&backends_dst));
444442
cp_r(&backends_src, &backends_dst);
445443

src/librustc_driver/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box<TransCrate> {
289289
let sysroot = sysroot_candidates.iter()
290290
.map(|sysroot| {
291291
let libdir = filesearch::relative_target_lib_path(&sysroot, &target);
292-
sysroot.join(&libdir).join("codegen-backends")
292+
sysroot.join(libdir).with_file_name("codegen-backends")
293293
})
294294
.filter(|f| {
295295
info!("codegen backend candidate: {}", f.display());

0 commit comments

Comments
 (0)