No branch protection metadata unless enabled
Even if we emit metadata disabling branch protection, this metadata may conflict with other modules (e.g. during LTO) that have different branch protection metadata set. This is an unstable flag and feature, so ideally the flag not being specified should act as if the feature wasn't implemented in the first place. Additionally this PR also ensures we emit an error if `-Zbranch-protection` is set on targets other than the supported aarch64. For now the error is being output from codegen, but ideally it should be moved to earlier in the pipeline before stabilization.
This commit is contained in:
parent
cb4ee81ef5
commit
b995dc944c
8 changed files with 82 additions and 55 deletions
|
@ -984,9 +984,10 @@ mod parse {
|
|||
true
|
||||
}
|
||||
|
||||
crate fn parse_branch_protection(slot: &mut BranchProtection, v: Option<&str>) -> bool {
|
||||
crate fn parse_branch_protection(slot: &mut Option<BranchProtection>, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
Some(s) => {
|
||||
let slot = slot.get_or_insert_default();
|
||||
for opt in s.split(',') {
|
||||
match opt {
|
||||
"bti" => slot.bti = true,
|
||||
|
@ -1161,7 +1162,7 @@ options! {
|
|||
(default: no)"),
|
||||
borrowck: String = ("migrate".to_string(), parse_string, [UNTRACKED],
|
||||
"select which borrowck is used (`mir` or `migrate`) (default: `migrate`)"),
|
||||
branch_protection: BranchProtection = (BranchProtection::default(), parse_branch_protection, [TRACKED],
|
||||
branch_protection: Option<BranchProtection> = (None, parse_branch_protection, [TRACKED],
|
||||
"set options for branch target identification and pointer authentication on AArch64"),
|
||||
cf_protection: CFProtection = (CFProtection::None, parse_cfprotection, [TRACKED],
|
||||
"instrument control-flow architecture protection"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue