bootstrap: Remove usage of RUSTC_TARGET_LINKER

Cargo has a native enviroment variable for this.
This commit is contained in:
Alex Crichton 2019-08-15 13:51:47 -07:00
parent c36849a542
commit d63e2def82
4 changed files with 13 additions and 17 deletions

View file

@ -148,11 +148,6 @@ fn main() {
cmd.arg("-L").arg(&root);
}
// Override linker if necessary.
if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") {
cmd.arg(format!("-Clinker={}", target_linker));
}
// If we're compiling specifically the `panic_abort` crate then we pass
// the `-C panic=abort` option. Note that we do not do this for any
// other crate intentionally as this is the only crate for now that we

View file

@ -926,7 +926,8 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_HOST_LINKER", host_linker);
}
if let Some(target_linker) = self.linker(target) {
cargo.env("RUSTC_TARGET_LINKER", target_linker);
let target = crate::envify(&target);
cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
}
if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc {
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));

View file

@ -1320,3 +1320,13 @@ impl Compiler {
self.stage >= final_stage
}
}
fn envify(s: &str) -> String {
s.chars()
.map(|c| match c {
'-' => '_',
c => c,
})
.flat_map(|c| c.to_uppercase())
.collect()
}

View file

@ -23,7 +23,7 @@ use crate::tool::{self, Tool, SourceType};
use crate::toolstate::ToolState;
use crate::util::{self, dylib_path, dylib_path_var};
use crate::Crate as CargoCrate;
use crate::{DocTests, Mode, GitRepo};
use crate::{DocTests, Mode, GitRepo, envify};
const ADB_TEST_DIR: &str = "/data/tmp/work";
@ -1913,16 +1913,6 @@ impl Step for CrateRustdoc {
}
}
fn envify(s: &str) -> String {
s.chars()
.map(|c| match c {
'-' => '_',
c => c,
})
.flat_map(|c| c.to_uppercase())
.collect()
}
/// Some test suites are run inside emulators or on remote devices, and most
/// of our test binaries are linked dynamically which means we need to ship
/// the standard library and such to the emulator ahead of time. This step