Port SanitizerMemtagRequiresMte
This commit is contained in:
parent
02403ee31d
commit
978b5f73e4
@ -12,6 +12,7 @@
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::attributes;
|
||||
use crate::errors::SanitizerMemtagRequiresMte;
|
||||
use crate::llvm::AttributePlace::Function;
|
||||
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
|
||||
use crate::llvm_util;
|
||||
@ -82,7 +83,7 @@ pub fn sanitize_attrs<'ll>(
|
||||
let mte_feature =
|
||||
features.iter().map(|s| &s[..]).rfind(|n| ["+mte", "-mte"].contains(&&n[..]));
|
||||
if let None | Some("-mte") = mte_feature {
|
||||
cx.tcx.sess.err("`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`");
|
||||
cx.tcx.sess.emit_err(SanitizerMemtagRequiresMte);
|
||||
}
|
||||
|
||||
attrs.push(llvm::AttributeKind::SanitizeMemTag.create_attr(cx.llcx));
|
||||
|
@ -80,3 +80,7 @@ pub(crate) struct LinkageConstOrMutType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(codegen_llvm::sanitizer_memtag_requires_mte)]
|
||||
pub(crate) struct SanitizerMemtagRequiresMte;
|
||||
|
@ -33,3 +33,6 @@ codegen_llvm_invalid_minimum_alignment =
|
||||
|
||||
codegen_llvm_linkage_const_or_mut_type =
|
||||
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
|
||||
|
||||
codegen_llvm_sanitizer_memtag_requires_mte =
|
||||
`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`
|
||||
|
Loading…
Reference in New Issue
Block a user