diff options
| author | Jacob Bramley <jacob.bramley@arm.com> | 2022-11-21 16:05:51 +0000 |
|---|---|---|
| committer | Jacob Bramley <jacob.bramley@arm.com> | 2022-12-06 15:51:57 +0000 |
| commit | 49f3c0b73689eed49df9ef822f9fd437db93ce9e (patch) | |
| tree | 2d0f6319ecfa15ba1b4de2d805dc7c8920fcef0f /compiler/rustc_codegen_llvm | |
| parent | 203c8765ea33c65d888febe0e8219c4bb11b0d89 (diff) | |
| download | rust-49f3c0b73689eed49df9ef822f9fd437db93ce9e.tar.gz rust-49f3c0b73689eed49df9ef822f9fd437db93ce9e.zip | |
Check AArch64 branch-protection earlier in the pipeline.
As suggested in #93516.
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/errors.rs | 4 |
2 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 4dcc7cd5447..a22a67ad7d3 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -3,7 +3,6 @@ use crate::back::write::to_llvm_code_model; use crate::callee::get_fn; use crate::coverageinfo; use crate::debuginfo; -use crate::errors::BranchProtectionRequiresAArch64; use crate::llvm; use crate::llvm_util; use crate::type_::Type; @@ -275,10 +274,9 @@ pub unsafe fn create_module<'ll>( } } - if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection { - if sess.target.arch != "aarch64" { - sess.emit_err(BranchProtectionRequiresAArch64); - } else { + // 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 { llvm::LLVMRustAddModuleFlag( llmod, llvm::LLVMModFlagBehavior::Error, diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index fddfbb23c67..de508f917f3 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -52,10 +52,6 @@ pub(crate) struct SymbolAlreadyDefined<'a> { } #[derive(Diagnostic)] -#[diag(codegen_llvm_branch_protection_requires_aarch64)] -pub(crate) struct BranchProtectionRequiresAArch64; - -#[derive(Diagnostic)] #[diag(codegen_llvm_invalid_minimum_alignment)] pub(crate) struct InvalidMinimumAlignment { pub err: String, |
