diff options
| author | Arlie Davis <ardavis@microsoft.com> | 2023-11-21 14:35:02 -0800 |
|---|---|---|
| committer | Arlie Davis <ardavis@microsoft.com> | 2023-11-21 14:35:02 -0800 |
| commit | 80896cbe351aa31ddc2f805c71e7eff85495d902 (patch) | |
| tree | 8d15040cd1499dbe3d5149b99d12c2c73e5a26c4 | |
| parent | 9429d68842a90fec21b5bed7419840bd86baaeab (diff) | |
| download | rust-80896cbe351aa31ddc2f805c71e7eff85495d902.tar.gz rust-80896cbe351aa31ddc2f805c71e7eff85495d902.zip | |
update -Cehcont-guard and comment
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 5fd0d6a50ca..507306fd274 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -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 |
