about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
diff options
context:
space:
mode:
authorO01eg <o01eg@yandex.ru>2020-05-29 16:50:03 +0300
committerO01eg <o01eg@yandex.ru>2020-05-29 16:50:03 +0300
commitce722999ea7a150d57504222e16107ef8a6556e6 (patch)
tree117e1d568e0b01dcf0618558315a5b1e248e1a3e /src/bootstrap/lib.rs
parent45127211566c53bac386b66909a830649182ab7a (diff)
downloadrust-ce722999ea7a150d57504222e16107ef8a6556e6.tar.gz
rust-ce722999ea7a150d57504222e16107ef8a6556e6.zip
Fix lld detection if stage0 rustc built with custom libdir
Diffstat (limited to 'src/bootstrap/lib.rs')
-rw-r--r--src/bootstrap/lib.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 15bf831a148..5328ccb64df 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(),