mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #154677 - Darksonn:hwasan-tagged-globals, r=davidtwco
hwaddress: automatically add `-Ctarget-feature=+tagged-globals` Note that since HWAddressSanitizer is/should be a target modifier, we do not have to worry about whether this LLVM target feature changes the ABI. Fixes: rust-lang/rust#148185
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
use rustc_session::lint::builtin::AARCH64_SOFTFLOAT_NEON;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::{Span, Symbol, edit_distance, sym};
|
||||
use rustc_target::spec::Arch;
|
||||
use rustc_target::spec::{Arch, SanitizerSet};
|
||||
use rustc_target::target_features::{RUSTC_SPECIFIC_FEATURES, Stability};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@@ -460,6 +460,15 @@ pub fn retpoline_features_by_flags(sess: &Session, features: &mut Vec<String>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Computes the backend target features to be added to account for sanitizer flags.
|
||||
pub fn sanitizer_features_by_flags(sess: &Session, features: &mut Vec<String>) {
|
||||
// It's intentional that this is done only for non-kernel version of hwaddress. This matches
|
||||
// clang behavior.
|
||||
if sess.sanitizers().contains(SanitizerSet::HWADDRESS) {
|
||||
features.push("+tagged-globals".into());
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
rust_target_features: |tcx, cnum| {
|
||||
|
||||
Reference in New Issue
Block a user