about summary refs log tree commit diff
path: root/src/bootstrap/bin/rustc.rs
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2023-10-05 10:47:59 +0200
committerJakub Beránek <jakub.beranek@vsb.cz>2023-10-05 15:40:34 +0200
commiteddbd7c6a0f45578e89c8f509bfff0c048a580d0 (patch)
tree85a767cb4af1a3c08373c3ddef451b8614f47f98 /src/bootstrap/bin/rustc.rs
parentc373a05bdbc4cd0b140ae3c08122e3d597869c94 (diff)
downloadrust-eddbd7c6a0f45578e89c8f509bfff0c048a580d0.tar.gz
rust-eddbd7c6a0f45578e89c8f509bfff0c048a580d0.zip
Pass host flags to `rustc` shim using prefixed env. vars
Diffstat (limited to 'src/bootstrap/bin/rustc.rs')
-rw-r--r--src/bootstrap/bin/rustc.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 20cd63b966b..119000b0935 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -111,20 +111,11 @@ fn main() {
         // FIXME(rust-lang/cargo#5754) we shouldn't be using special env vars
         // here, but rather Cargo should know what flags to pass rustc itself.
 
-        // Override linker if necessary.
-        if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
-            cmd.arg(format!("-Clinker={host_linker}"));
-        }
-        if env::var_os("RUSTC_HOST_FUSE_LD_LLD").is_some() {
-            cmd.arg("-Clink-args=-fuse-ld=lld");
-        }
-
-        if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") {
-            if s == "true" {
-                cmd.arg("-C").arg("target-feature=+crt-static");
-            }
-            if s == "false" {
-                cmd.arg("-C").arg("target-feature=-crt-static");
+        // Find any host flags that were passed by bootstrap.
+        // The flags are stored in a RUSTC_HOST_FLAGS variable, separated by spaces.
+        if let Ok(flags) = std::env::var("RUSTC_HOST_FLAGS") {
+            for flag in flags.split(' ') {
+                cmd.arg(flag);
             }
         }