diff options
| author | Kajetan Puchalski <kajetan.puchalski@arm.com> | 2024-10-16 15:39:58 +0100 |
|---|---|---|
| committer | Kajetan Puchalski <kajetan.puchalski@arm.com> | 2024-10-31 11:59:17 +0000 |
| commit | 10edeea4b48d852fb9366a2d4d4dde5055501a7c (patch) | |
| tree | 2bdbaae0dc79adc1f234df41eb542e46d179a6aa /compiler/rustc_session/src/options.rs | |
| parent | 4d296eabe4c5cfbce9bb68e6221bca2165aae97b (diff) | |
| download | rust-10edeea4b48d852fb9366a2d4d4dde5055501a7c.tar.gz rust-10edeea4b48d852fb9366a2d4d4dde5055501a7c.zip | |
rustc_codegen_llvm: Add a new 'pc' option to branch-protection
Add a new 'pc' option to -Z branch-protection for aarch64 that enables the use of PC as a diversifier in PAC branch protection code. When the pauth-lr target feature is enabled in combination with -Z branch-protection=pac-ret,pc, the new 9.5-a instructions (pacibsppc, retaasppc, etc) will be generated.
Diffstat (limited to 'compiler/rustc_session/src/options.rs')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 54a4621db24..8eba4c68990 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -442,8 +442,7 @@ mod desc { pub(crate) const parse_polonius: &str = "either no value or `legacy` (the default), or `next`"; pub(crate) const parse_stack_protector: &str = "one of (`none` (default), `basic`, `strong`, or `all`)"; - pub(crate) const parse_branch_protection: &str = - "a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`"; + pub(crate) const parse_branch_protection: &str = "a `,` separated combination of `bti`, `pac-ret`, followed by a combination of `pc`, `b-key`, or `leaf`"; pub(crate) const parse_proc_macro_execution_strategy: &str = "one of supported execution strategies (`same-thread`, or `cross-thread`)"; pub(crate) const parse_remap_path_scope: &str = @@ -1396,7 +1395,7 @@ mod parse { match opt { "bti" => slot.bti = true, "pac-ret" if slot.pac_ret.is_none() => { - slot.pac_ret = Some(PacRet { leaf: false, key: PAuthKey::A }) + slot.pac_ret = Some(PacRet { leaf: false, pc: false, key: PAuthKey::A }) } "leaf" => match slot.pac_ret.as_mut() { Some(pac) => pac.leaf = true, @@ -1406,6 +1405,10 @@ mod parse { Some(pac) => pac.key = PAuthKey::B, _ => return false, }, + "pc" => match slot.pac_ret.as_mut() { + Some(pac) => pac.pc = true, + _ => return false, + }, _ => return false, }; } |
