Skip to content

Commit ce72299

Browse files
committed
Fix lld detection if stage0 rustc built with custom libdir
1 parent 4512721 commit ce72299

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/bootstrap/lib.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,19 @@ impl Build {
344344
// we always try to use git for LLVM builds
345345
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
346346

347-
let initial_sysroot = config.initial_rustc.parent().unwrap().parent().unwrap();
348-
let initial_lld = initial_sysroot
349-
.join("lib")
350-
.join("rustlib")
351-
.join(config.build)
352-
.join("bin")
353-
.join("rust-lld");
347+
let initial_target_libdir = if config.dry_run {
348+
"/dummy/path/to/lib/".to_string()
349+
} else {
350+
output(
351+
Command::new(&config.initial_rustc)
352+
.arg("--target")
353+
.arg(config.build)
354+
.arg("--print")
355+
.arg("target-libdir"),
356+
)
357+
};
358+
let initial_lld =
359+
Path::new(&initial_target_libdir).parent().unwrap().join("bin").join("rust-lld");
354360

355361
let mut build = Build {
356362
initial_rustc: config.initial_rustc.clone(),

0 commit comments

Comments
 (0)