diff options
author | Michael Woerister <michaelwoerister@posteo> | 2019-01-25 12:34:59 +0100 |
---|---|---|
committer | Michael Woerister <michaelwoerister@posteo> | 2019-01-30 16:21:43 +0100 |
commit | 9c29517af9cc44683fabcdf8c4b9b9c650e33ca6 (patch) | |
tree | de0791daea78b86ebda55462850c3129f21885e0 | |
parent | 4460e7c919921ee0fbfd4804d2df33996f404581 (diff) | |
download | rust-9c29517af9cc44683fabcdf8c4b9b9c650e33ca6.tar.gz |
bootstrap: Make LLD available to run-make tests.
-rw-r--r-- | src/bootstrap/tool.rs | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 9f6db73e6f7..cd3afc59e56 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -1,6 +1,5 @@ use std::fs; use std::env; -use std::iter; use std::path::PathBuf; use std::process::{Command, exit}; use std::collections::HashSet; @@ -666,19 +665,33 @@ impl<'a> Builder<'a> { // Add the llvm/bin directory to PATH since it contains lots of // useful, platform-independent tools - if tool.uses_llvm_tools() { + if tool.uses_llvm_tools() && !self.config.dry_run { + let mut additional_paths = vec![]; + if let Some(llvm_bin_path) = self.llvm_bin_path() { - if host.contains("windows") { - // On Windows, PATH and the dynamic library path are the same, - // so we just add the LLVM bin path to lib_path - lib_paths.push(llvm_bin_path); - } else { - let old_path = env::var_os("PATH").unwrap_or_default(); - let new_path = env::join_paths(iter::once(llvm_bin_path) - .chain(env::split_paths(&old_path))) - .expect("Could not add LLVM bin path to PATH"); - cmd.env("PATH", new_path); - } + additional_paths.push(llvm_bin_path); + } + + // If LLD is available, add that too. + if self.config.lld_enabled { + let lld_install_root = self.ensure(native::Lld { + target: self.config.build, + }); + + let lld_bin_path = lld_install_root.join("bin"); + additional_paths.push(lld_bin_path); + } + + if host.contains("windows") { + // On Windows, PATH and the dynamic library path are the same, + // so we just add the LLVM bin path to lib_path + lib_paths.extend(additional_paths); + } else { + let old_path = env::var_os("PATH").unwrap_or_default(); + let new_path = env::join_paths(additional_paths.into_iter() + .chain(env::split_paths(&old_path))) + .expect("Could not add LLVM bin path to PATH"); + cmd.env("PATH", new_path); } } @@ -686,7 +699,7 @@ impl<'a> Builder<'a> { } fn llvm_bin_path(&self) -> Option<PathBuf> { - if self.config.llvm_enabled && !self.config.dry_run { + if self.config.llvm_enabled { let llvm_config = self.ensure(native::Llvm { target: self.config.build, emscripten: false, |