Port branch protection on aarch64
This commit is contained in:
parent
ec1e101e1b
commit
59b8aedf0e
3 changed files with 9 additions and 1 deletions
|
@ -3,6 +3,7 @@ use crate::back::write::to_llvm_code_model;
|
||||||
use crate::callee::get_fn;
|
use crate::callee::get_fn;
|
||||||
use crate::coverageinfo;
|
use crate::coverageinfo;
|
||||||
use crate::debuginfo;
|
use crate::debuginfo;
|
||||||
|
use crate::errors::BranchProtectionRequiresAArch64;
|
||||||
use crate::llvm;
|
use crate::llvm;
|
||||||
use crate::llvm_util;
|
use crate::llvm_util;
|
||||||
use crate::type_::Type;
|
use crate::type_::Type;
|
||||||
|
@ -275,7 +276,7 @@ pub unsafe fn create_module<'ll>(
|
||||||
|
|
||||||
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" {
|
if sess.target.arch != "aarch64" {
|
||||||
sess.err("-Zbranch-protection is only supported on aarch64");
|
sess.emit_err(BranchProtectionRequiresAArch64);
|
||||||
} else {
|
} else {
|
||||||
llvm::LLVMRustAddModuleFlag(
|
llvm::LLVMRustAddModuleFlag(
|
||||||
llmod,
|
llmod,
|
||||||
|
|
|
@ -55,3 +55,7 @@ pub(crate) struct SymbolAlreadyDefined<'a> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub symbol_name: &'a str,
|
pub symbol_name: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(SessionDiagnostic)]
|
||||||
|
#[diag(codegen_llvm::branch_protection_requires_aarch64)]
|
||||||
|
pub(crate) struct BranchProtectionRequiresAArch64;
|
||||||
|
|
|
@ -21,3 +21,6 @@ codegen_llvm_instrument_coverage_requires_llvm_12 =
|
||||||
|
|
||||||
codegen_llvm_symbol_already_defined =
|
codegen_llvm_symbol_already_defined =
|
||||||
symbol `{$symbol_name}` is already defined
|
symbol `{$symbol_name}` is already defined
|
||||||
|
|
||||||
|
codegen_llvm_branch_protection_requires_aarch64 =
|
||||||
|
-Zbranch-protection is only supported on aarch64
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue