Skip to content

Commit

Permalink
update -Cehcont-guard and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Nov 21, 2023
1 parent 9429d68 commit 80896cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1964,10 +1964,14 @@ impl<'a> Builder<'a> {
rustflags.arg("-Ccontrol-flow-guard");
}

// Same for EHCont Guard (this is not combined with the previous if-statement to make
// merges with upstream easier).
// If EHCont Guard is enabled, pass the `-Zehcont-guard` flag to rustc when compiling the
// standard library, since this might be linked into the final outputs produced by rustc.
// Since this mitigation is only available on Windows, only enable it for the standard
// library in case the compiler is run on a non-Windows platform.
// This is not needed for stage 0 artifacts because these will only be used for building
// the stage 1 compiler.
if cfg!(windows) && mode == Mode::Std && self.config.ehcont_guard && compiler.stage >= 1 {
rustflags.arg("-Cehcont-guard");
rustflags.arg("-Zehcont-guard");
}

// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
Expand Down

0 comments on commit 80896cb

Please sign in to comment.