diff options
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index a22a67ad7d3..f6fcdc90cb6 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -274,9 +274,8 @@ pub unsafe fn create_module<'ll>( } } - // AArch64-only options (checked in rustc_session). - if sess.target.arch == "aarch64" { - if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection { + if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection { + if sess.target.arch == "aarch64" { llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Error, @@ -302,6 +301,11 @@ pub unsafe fn create_module<'ll>( "sign-return-address-with-bkey\0".as_ptr().cast(), u32::from(pac_opts.key == PAuthKey::B), ); + } else { + bug!( + "branch-protection used on non-AArch64 target; \ + this should be checked in rustc_session." + ); } } |
