From ce722999ea7a150d57504222e16107ef8a6556e6 Mon Sep 17 00:00:00 2001 From: O01eg Date: Fri, 29 May 2020 16:50:03 +0300 Subject: [PATCH] Fix lld detection if stage0 rustc built with custom libdir --- src/bootstrap/lib.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 15bf831a14835..5328ccb64df7e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -344,13 +344,19 @@ impl Build { // we always try to use git for LLVM builds let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project")); - let initial_sysroot = config.initial_rustc.parent().unwrap().parent().unwrap(); - let initial_lld = initial_sysroot - .join("lib") - .join("rustlib") - .join(config.build) - .join("bin") - .join("rust-lld"); + let initial_target_libdir = if config.dry_run { + "/dummy/path/to/lib/".to_string() + } else { + output( + Command::new(&config.initial_rustc) + .arg("--target") + .arg(config.build) + .arg("--print") + .arg("target-libdir"), + ) + }; + let initial_lld = + Path::new(&initial_target_libdir).parent().unwrap().join("bin").join("rust-lld"); let mut build = Build { initial_rustc: config.initial_rustc.clone(),