Skip to content

Commit 42ec597

Browse files
Rollup merge of #42429 - venkatagiri:llvm_config, r=alexcrichton
rustc_llvm: re-run build script if config.toml changes closes #35199
2 parents f99a07d + 40f8536 commit 42ec597

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/bootstrap/compile.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
276276
if build.is_rust_llvm(target) {
277277
cargo.env("LLVM_RUSTLLVM", "1");
278278
}
279+
if let Some(ref cfg_file) = build.flags.config {
280+
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
281+
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
282+
}
279283
cargo.env("LLVM_CONFIG", build.llvm_config(target));
280284
let target_config = build.config.target_config.get(target);
281285
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {

src/librustc_llvm/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ fn main() {
6161

6262
println!("cargo:rerun-if-changed={}", llvm_config.display());
6363

64+
if let Some(cfg_toml) = env::var_os("CFG_LLVM_TOML") {
65+
let cfg_path = PathBuf::from(cfg_toml);
66+
println!("cargo:rerun-if-changed={}", cfg_path.display());
67+
}
68+
6469
// Test whether we're cross-compiling LLVM. This is a pretty rare case
6570
// currently where we're producing an LLVM for a different platform than
6671
// what this build script is currently running on.

0 commit comments

Comments
 (0)