about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorArlie Davis <ardavis@microsoft.com>2023-11-17 10:05:38 -0800
committerArlie Davis <ardavis@microsoft.com>2023-11-21 13:41:23 -0800
commite11d8d147b94043d54d0a6c8ff0bdb0568b794ca (patch)
tree8d209b5b6c776646a481e11225ccf41cf314ecbf /compiler/rustc_session
parent2f8d81f9dbac6b8df982199f69da04a4c8357227 (diff)
downloadrust-e11d8d147b94043d54d0a6c8ff0bdb0568b794ca.tar.gz
rust-e11d8d147b94043d54d0a6c8ff0bdb0568b794ca.zip
Add support for generating the EHCont section
In the future Windows will enable Control-flow Enforcement Technology
(CET aka Shadow Stacks). To protect the path where the context is
updated during exception handling, the binary is required to enumerate
valid unwind entrypoints in a dedicated section which is validated when
the context is being set during exception handling.

The required support for EHCONT has already been merged into LLVM,
long ago. This change adds the Rust codegen option to enable it.

Reference:

* https://reviews.llvm.org/D40223

This also adds a new `ehcont-guard` option to the bootstrap config which
enables EHCont Guard when building std.
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/options.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index b824eb51ef7..924bd97b4d5 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -1387,6 +1387,8 @@ options! {
         "allow the linker to link its default libraries (default: no)"),
     dlltool: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
         "import library generation tool (ignored except when targeting windows-gnu)"),
+    ehcont_guard: bool = (false, parse_bool, [TRACKED],
+        "generate Windows EHCont Guard tables"),
     embed_bitcode: bool = (true, parse_bool, [TRACKED],
         "emit bitcode in rlibs (default: yes)"),
     extra_filename: String = (String::new(), parse_string, [UNTRACKED],