Skip to content

Commit 3f18a41

Browse files
committed
Add verify-llvm-ir flag to config.toml
1 parent 22cf833 commit 3f18a41

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@
356356
# Print backtrace on internal compiler errors during bootstrap
357357
#backtrace-on-ice = false
358358

359+
# Whether to verify generated LLVM IR
360+
#verify-llvm-ir = false
361+
359362
# =============================================================================
360363
# Options for specific targets
361364
#

src/bootstrap/bin/rustc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ fn main() {
283283
cmd.arg("--cfg").arg("parallel_queries");
284284
}
285285

286+
if env::var_os("RUSTC_VERIFY_LLVM_IR").is_some() {
287+
cmd.arg("-Z").arg("verify-llvm-ir");
288+
}
289+
286290
let color = match env::var("RUSTC_COLOR") {
287291
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
288292
Err(_) => 0,

src/bootstrap/builder.rs

+4
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ impl<'a> Builder<'a> {
898898
cargo.env("RUSTC_BACKTRACE_ON_ICE", "1");
899899
}
900900

901+
if self.config.rust_verify_llvm_ir {
902+
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
903+
}
904+
901905
cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
902906

903907
// in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ pub struct Config {
105105
pub rust_dist_src: bool,
106106
pub rust_codegen_backends: Vec<Interned<String>>,
107107
pub rust_codegen_backends_dir: String,
108+
pub rust_verify_llvm_ir: bool,
108109

109110
pub build: Interned<String>,
110111
pub hosts: Vec<Interned<String>>,
@@ -311,6 +312,7 @@ struct Rust {
311312
lld: Option<bool>,
312313
deny_warnings: Option<bool>,
313314
backtrace_on_ice: Option<bool>,
315+
verify_llvm_ir: Option<bool>,
314316
}
315317

316318
/// TOML representation of how each build target is configured.
@@ -542,6 +544,7 @@ impl Config {
542544
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
543545
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
544546
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
547+
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
545548

546549
if let Some(ref backends) = rust.codegen_backends {
547550
config.rust_codegen_backends = backends.iter()

0 commit comments

Comments
 (0)