From f24b0d358ac32af14994657865e1b4493550dc7a Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Fri, 24 Jan 2025 10:48:53 -0500 Subject: [PATCH] Add comment to explain why CG_RUSTFLAGS is needed --- build_system/src/build.rs | 2 ++ build_system/src/config.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build_system/src/build.rs b/build_system/src/build.rs index d0ced211a616..a027c82a0b56 100644 --- a/build_system/src/build.rs +++ b/build_system/src/build.rs @@ -150,6 +150,8 @@ pub fn build_sysroot(env: &HashMap, config: &ConfigInfo) -> Resu "debug" }; + // We have a different environment variable than RUSTFLAGS to make sure those flags are only + // sent to rustc_codegen_gcc and not the LLVM backend. if let Ok(cg_rustflags) = std::env::var("CG_RUSTFLAGS") { rustflags.push(' '); rustflags.push_str(&cg_rustflags); diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 37b4b68950e4..f10eee2651a7 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -381,6 +381,8 @@ impl ConfigInfo { } // This environment variable is useful in case we want to change options of rustc commands. + // We have a different environment variable than RUSTFLAGS to make sure those flags are + // only sent to rustc_codegen_gcc and not the LLVM backend. if let Some(cg_rustflags) = env.get("CG_RUSTFLAGS") { rustflags.extend_from_slice(&split_args(&cg_rustflags)?); }