diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-08-15 13:51:47 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-09-23 09:34:44 -0700 |
| commit | d63e2def82f208f8c15c78db5f0f58cc14792972 (patch) | |
| tree | b5d5cad2e742bf9eb907c7d0323302fa60b8ff3a /src | |
| parent | c36849a542cdff30f7eaa829433f31d4bcb79c56 (diff) | |
| download | rust-d63e2def82f208f8c15c78db5f0f58cc14792972.tar.gz rust-d63e2def82f208f8c15c78db5f0f58cc14792972.zip | |
bootstrap: Remove usage of `RUSTC_TARGET_LINKER`
Cargo has a native enviroment variable for this.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 10 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 12 |
4 files changed, 13 insertions, 17 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 1955ca4aa99..d0d995d704e 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -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 diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ee62b397678..a7e9b9aaf64 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -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)); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 5d7581c8211..9203a558f64 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -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() +} diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 00d87f3841c..37718ed89c1 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -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 |
