Skip to content

Commit

Permalink
Add verify-llvm-ir flag to config.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 12, 2018
1 parent 22cf833 commit 3f18a41
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
# Print backtrace on internal compiler errors during bootstrap
#backtrace-on-ice = false

# Whether to verify generated LLVM IR
#verify-llvm-ir = false

# =============================================================================
# Options for specific targets
#
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ fn main() {
cmd.arg("--cfg").arg("parallel_queries");
}

if env::var_os("RUSTC_VERIFY_LLVM_IR").is_some() {
cmd.arg("-Z").arg("verify-llvm-ir");
}

let color = match env::var("RUSTC_COLOR") {
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
Err(_) => 0,
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,10 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_BACKTRACE_ON_ICE", "1");
}

if self.config.rust_verify_llvm_ir {
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
}

cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));

// in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub struct Config {
pub rust_dist_src: bool,
pub rust_codegen_backends: Vec<Interned<String>>,
pub rust_codegen_backends_dir: String,
pub rust_verify_llvm_ir: bool,

pub build: Interned<String>,
pub hosts: Vec<Interned<String>>,
Expand Down Expand Up @@ -311,6 +312,7 @@ struct Rust {
lld: Option<bool>,
deny_warnings: Option<bool>,
backtrace_on_ice: Option<bool>,
verify_llvm_ir: Option<bool>,
}

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

if let Some(ref backends) = rust.codegen_backends {
config.rust_codegen_backends = backends.iter()
Expand Down

0 comments on commit 3f18a41

Please sign in to comment.