1 // The sheer existence of this file is an awful hack. See the comments in
2 // `src/bootstrap/native.rs` for why this is needed when compiling LLD.
5 use std::io::{self, Write};
6 use std::process::{self, Command, Stdio};
9 let real_llvm_config = env::var_os("LLVM_CONFIG_REAL").unwrap();
10 let mut cmd = Command::new(real_llvm_config);
11 cmd.args(env::args().skip(1)).stderr(Stdio::piped());
12 let output = cmd.output().expect("failed to spawn llvm-config");
13 let mut stdout = String::from_utf8_lossy(&output.stdout);
15 if let Ok(to_replace) = env::var("LLVM_CONFIG_SHIM_REPLACE") {
16 if let Ok(replace_with) = env::var("LLVM_CONFIG_SHIM_REPLACE_WITH") {
17 stdout = stdout.replace(&to_replace, &replace_with).into();
21 print!("{}", stdout.replace("\\", "/"));
22 io::stdout().flush().unwrap();
23 process::exit(output.status.code().unwrap_or(1));