Skip to content

Commit 80896cb

Browse files
committed
update -Cehcont-guard and comment
1 parent 9429d68 commit 80896cb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bootstrap/src/core/builder.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1964,10 +1964,14 @@ impl<'a> Builder<'a> {
19641964
rustflags.arg("-Ccontrol-flow-guard");
19651965
}
19661966

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

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

0 commit comments

Comments
 (0)