mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Port SanitizerMemtagRequiresMte
This commit is contained in:
parent
02403ee31d
commit
978b5f73e4
@ -12,6 +12,7 @@ use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType, StackProtec
|
|||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use crate::attributes;
|
use crate::attributes;
|
||||||
|
use crate::errors::SanitizerMemtagRequiresMte;
|
||||||
use crate::llvm::AttributePlace::Function;
|
use crate::llvm::AttributePlace::Function;
|
||||||
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
|
use crate::llvm::{self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects};
|
||||||
use crate::llvm_util;
|
use crate::llvm_util;
|
||||||
@ -82,7 +83,7 @@ pub fn sanitize_attrs<'ll>(
|
|||||||
let mte_feature =
|
let mte_feature =
|
||||||
features.iter().map(|s| &s[..]).rfind(|n| ["+mte", "-mte"].contains(&&n[..]));
|
features.iter().map(|s| &s[..]).rfind(|n| ["+mte", "-mte"].contains(&&n[..]));
|
||||||
if let None | Some("-mte") = mte_feature {
|
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));
|
attrs.push(llvm::AttributeKind::SanitizeMemTag.create_attr(cx.llcx));
|
||||||
|
@ -80,3 +80,7 @@ pub(crate) struct LinkageConstOrMutType {
|
|||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: 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 =
|
codegen_llvm_linkage_const_or_mut_type =
|
||||||
must have type `*const T` or `*mut T` due to `#[linkage]` attribute
|
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