diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 15b4d5247a978..a4602baae1d26 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -16,7 +16,6 @@ use rustc_session::{Session, config}; use rustc_target::callconv::{ ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, PassMode, }; -use rustc_target::spec::SanitizerSet; use smallvec::SmallVec; use crate::attributes::{self, llfn_attrs_from_instance}; @@ -92,7 +91,7 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&' attrs.push(llattr.create_attr(cx.llcx)); } } - } else if cx.tcx.sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::MEMORY) { + } else if cx.tcx.sess.is_sanitizer_memory_enabled() { // If we're not optimising, *but* memory sanitizer is on, emit noundef, since it affects // memory sanitizer's behavior. diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 8070ea0b3e927..23c13f40b4808 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -100,7 +100,7 @@ pub(crate) fn sanitize_attrs<'ll, 'tcx>( no_sanitize: SanitizerSet, ) -> SmallVec<[&'ll Attribute; 4]> { let mut attrs = SmallVec::new(); - let enabled = tcx.sess.opts.unstable_opts.sanitizer - no_sanitize; + let enabled = tcx.sess.opts.cg.sanitize - no_sanitize; if enabled.contains(SanitizerSet::ADDRESS) || enabled.contains(SanitizerSet::KERNELADDRESS) { attrs.push(llvm::AttributeKind::SanitizeAddress.create_attr(cx.llcx)); } @@ -239,13 +239,7 @@ fn probestack_attr<'ll, 'tcx>(cx: &SimpleCx<'ll>, tcx: TyCtxt<'tcx>) -> Option<& // Currently stack probes seem somewhat incompatible with the address // sanitizer and thread sanitizer. With asan we're already protected from // stack overflow anyway so we don't really need stack probes regardless. - if tcx - .sess - .opts - .unstable_opts - .sanitizer - .intersects(SanitizerSet::ADDRESS | SanitizerSet::THREAD) - { + if tcx.sess.is_sanitizer_address_enabled() || tcx.sess.is_sanitizer_thread_enabled() { return None; } diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index ea538d3d46981..81795b8aba63e 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1226,7 +1226,7 @@ fn add_sanitizer_libraries( return; } - let sanitizer = sess.opts.unstable_opts.sanitizer; + let sanitizer = sess.opts.cg.sanitize; if sanitizer.contains(SanitizerSet::ADDRESS) { link_sanitizer_runtime(sess, flavor, linker, "asan"); } @@ -2496,11 +2496,7 @@ fn add_order_independent_options( && crate_type == CrateType::Executable && !matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _)) { - let prefix = if sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::ADDRESS) { - "asan/" - } else { - "" - }; + let prefix = if sess.is_sanitizer_address_enabled() { "asan/" } else { "" }; cmd.link_arg(format!("--dynamic-linker={prefix}ld.so.1")); } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index cbaf67d734547..feceeb364ab01 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -176,7 +176,7 @@ impl ModuleConfig { debug_info_for_profiling: sess.opts.unstable_opts.debug_info_for_profiling, instrument_coverage: if_regular!(sess.instrument_coverage(), false), - sanitizer: if_regular!(sess.opts.unstable_opts.sanitizer, SanitizerSet::empty()), + sanitizer: if_regular!(sess.opts.cg.sanitize, SanitizerSet::empty()), sanitizer_dataflow_abilist: if_regular!( sess.opts.unstable_opts.sanitizer_dataflow_abilist.clone(), Vec::new() diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 7e5186db4eafe..37ab093ac359d 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -639,6 +639,7 @@ fn test_codegen_options_tracking_hash() { tracked!(profile_use, Some(PathBuf::from("abc"))); tracked!(relocation_model, Some(RelocModel::Pic)); tracked!(relro_level, Some(RelroLevel::Full)); + tracked!(sanitize, SanitizerSet::ADDRESS); tracked!(soft_float, true); tracked!(split_debuginfo, Some(SplitDebuginfo::Packed)); tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0)); @@ -858,7 +859,6 @@ fn test_unstable_options_tracking_hash() { tracked!(regparm, Some(3)); tracked!(relax_elf_relocations, Some(true)); tracked!(remap_cwd_prefix, Some(PathBuf::from("abc"))); - tracked!(sanitizer, SanitizerSet::ADDRESS); tracked!(sanitizer_cfi_canonical_jump_tables, None); tracked!(sanitizer_cfi_generalize_pointers, Some(true)); tracked!(sanitizer_cfi_normalize_integers, Some(true)); diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 15572063d45a6..edb8b91498bdb 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -71,7 +71,7 @@ pub fn walk_native_lib_search_dirs( || sess.target.os == "linux" || sess.target.os == "fuchsia" || sess.target.is_like_aix - || sess.target.is_like_darwin && !sess.opts.unstable_opts.sanitizer.is_empty() + || sess.target.is_like_darwin && !sess.opts.cg.sanitize.is_empty() { f(&sess.target_tlib_path.dir, false)?; } diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index b46e8ab4fdcbe..eea5a1551d475 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -9,7 +9,7 @@ session_branch_protection_requires_aarch64 = `-Zbranch-protection` is only suppo session_cannot_enable_crt_static_linux = sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static` -session_cannot_mix_and_match_sanitizers = `-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}` +session_cannot_mix_and_match_sanitizers = `-Csanitize={$first}` is incompatible with `-Csanitize={$second}` session_cli_feature_diagnostic_help = add `-Zcrate-attr="feature({$feature})"` to the command-line options to enable @@ -92,15 +92,15 @@ session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C pr session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist -session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` +session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Csanitize=cfi` -session_sanitizer_cfi_generalize_pointers_requires_cfi = `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +session_sanitizer_cfi_generalize_pointers_requires_cfi = `-Zsanitizer-cfi-generalize-pointers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` -session_sanitizer_cfi_normalize_integers_requires_cfi = `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +session_sanitizer_cfi_normalize_integers_requires_cfi = `-Zsanitizer-cfi-normalize-integers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` -session_sanitizer_cfi_requires_lto = `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` +session_sanitizer_cfi_requires_lto = `-Csanitize=cfi` requires `-Clto` or `-Clinker-plugin-lto` -session_sanitizer_cfi_requires_single_codegen_unit = `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` +session_sanitizer_cfi_requires_single_codegen_unit = `-Csanitize=cfi` with `-Clto` requires `-Ccodegen-units=1` session_sanitizer_kcfi_arity_requires_kcfi = `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi` diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index a72f6201dcea2..93d604d4cf27a 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -224,7 +224,7 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg { ins_sym!(sym::relocation_model, sess.target.relocation_model.desc_symbol()); } - for mut s in sess.opts.unstable_opts.sanitizer { + for mut s in sess.opts.cg.sanitize { // KASAN is still ASAN under the hood, so it uses the same attribute. if s == SanitizerSet::KERNELADDRESS { s = SanitizerSet::ADDRESS; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 6dd90546de1b0..eee24026f65b5 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -116,7 +116,7 @@ mod target_modifier_consistency_check { r: Option<&TargetModifier>, ) -> bool { // For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier - if opts.unstable_opts.sanitizer.contains(SanitizerSet::KCFI) { + if opts.cg.sanitize.contains(SanitizerSet::KCFI) { if let Some(r) = r { return l.extend().tech_value == r.extend().tech_value; } else { @@ -136,10 +136,12 @@ impl TargetModifier { pub fn consistent(&self, opts: &Options, other: Option<&TargetModifier>) -> bool { assert!(other.is_none() || self.opt == other.unwrap().opt); match self.opt { - OptionsTargetModifiers::UnstableOptions(unstable) => match unstable { - UnstableOptionsTargetModifiers::sanitizer => { + OptionsTargetModifiers::CodegenOptions(stable) => match stable { + CodegenOptionsTargetModifiers::sanitize => { return target_modifier_consistency_check::sanitizer(self, other); } + }, + OptionsTargetModifiers::UnstableOptions(unstable) => match unstable { UnstableOptionsTargetModifiers::sanitizer_cfi_normalize_integers => { return target_modifier_consistency_check::sanitizer_cfi_normalize_integers( opts, self, other, @@ -147,7 +149,6 @@ impl TargetModifier { } _ => {} }, - _ => {} }; match other { Some(other) => self.extend().tech_value == other.extend().tech_value, @@ -1239,25 +1240,14 @@ pub mod parse { } pub(crate) fn parse_sanitizers(slot: &mut SanitizerSet, v: Option<&str>) -> bool { - if let Some(v) = v { - for s in v.split(',') { - *slot |= match s { - "address" => SanitizerSet::ADDRESS, - "cfi" => SanitizerSet::CFI, - "dataflow" => SanitizerSet::DATAFLOW, - "kcfi" => SanitizerSet::KCFI, - "kernel-address" => SanitizerSet::KERNELADDRESS, - "leak" => SanitizerSet::LEAK, - "memory" => SanitizerSet::MEMORY, - "memtag" => SanitizerSet::MEMTAG, - "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, - "thread" => SanitizerSet::THREAD, - "hwaddress" => SanitizerSet::HWADDRESS, - "safestack" => SanitizerSet::SAFESTACK, - _ => return false, - } + if let Some(s) = v { + let sanitizer_set = SanitizerSet::from_comma_list(s); + if sanitizer_set.is_ok() { + *slot |= sanitizer_set.unwrap(); + true + } else { + false } - true } else { false } @@ -2158,8 +2148,8 @@ options! { "output remarks for these optimization passes (space separated, or \"all\")"), rpath: bool = (false, parse_bool, [UNTRACKED], "set rpath values in libs/exes (default: no)"), - save_temps: bool = (false, parse_bool, [UNTRACKED], - "save all temporary output files during compilation (default: no)"), + sanitize: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], + "use one or multiple sanitizers"), soft_float: bool = (false, parse_bool, [TRACKED], "deprecated option: use soft float ABI (*eabihf targets only) (default: no)"), #[rustc_lint_opt_deny_field_access("use `Session::split_debuginfo` instead of this field")] @@ -2177,6 +2167,8 @@ options! { This feature is unsafe."), unsafe_allow_abi_mismatch: Vec = (Vec::new(), parse_comma_list, [UNTRACKED], "Allow incompatible target modifiers in dependency crates (comma separated list)"), + save_temps: bool = (false, parse_bool, [UNTRACKED], + "Allow incompatible target modifiers in dependency crates (comma separated list)"), // tidy-alphabetical-end // If you add a new option, please update: @@ -2575,8 +2567,6 @@ written to standard error output)"), retpoline_external_thunk: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \ target features (default: no)"), - sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], - "use a sanitizer"), sanitizer_cfi_canonical_jump_tables: Option = (Some(true), parse_opt_bool, [TRACKED], "enable canonical jump tables (default: yes)"), sanitizer_cfi_generalize_pointers: Option = (None, parse_opt_bool, [TRACKED], @@ -2594,6 +2584,8 @@ written to standard error output)"), saturating_float_casts: Option = (None, parse_opt_bool, [TRACKED], "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ the max/min integer respectively, and NaN is mapped to 0 (default: yes)"), + sanitize: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], + "use one or multiple sanitizers"), self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled, parse_switch_with_opt_path, [UNTRACKED], "run the self profiler and output the raw event data"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 172672a80fbd7..92df7924e1596 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -328,8 +328,12 @@ impl Session { &self.opts.unstable_opts.coverage_options } + pub fn is_sanitizer_address_enabled(&self) -> bool { + self.opts.cg.sanitize.contains(SanitizerSet::ADDRESS) + } + pub fn is_sanitizer_cfi_enabled(&self) -> bool { - self.opts.unstable_opts.sanitizer.contains(SanitizerSet::CFI) + self.opts.cg.sanitize.contains(SanitizerSet::CFI) } pub fn is_sanitizer_cfi_canonical_jump_tables_disabled(&self) -> bool { @@ -348,12 +352,36 @@ impl Session { self.opts.unstable_opts.sanitizer_cfi_normalize_integers == Some(true) } + pub fn is_sanitizer_hwaddress_enabled(&self) -> bool { + self.opts.cg.sanitize.contains(SanitizerSet::HWADDRESS) + } + pub fn is_sanitizer_kcfi_arity_enabled(&self) -> bool { self.opts.unstable_opts.sanitizer_kcfi_arity == Some(true) } pub fn is_sanitizer_kcfi_enabled(&self) -> bool { - self.opts.unstable_opts.sanitizer.contains(SanitizerSet::KCFI) + self.opts.cg.sanitize.contains(SanitizerSet::KCFI) + } + + pub fn is_sanitizer_kernel_address_enabled(&self) -> bool { + self.opts.cg.sanitize.contains(SanitizerSet::KERNELADDRESS) + } + + pub fn is_sanitizer_memory_enabled(&self) -> bool { + self.opts.cg.sanitize.contains(SanitizerSet::MEMORY) + } + + pub fn is_sanitizer_memory_recover_enabled(&self) -> bool { + self.opts.unstable_opts.sanitizer_recover.contains(SanitizerSet::MEMORY) + } + + pub fn is_sanitizer_memory_track_origins_enabled(&self) -> bool { + self.opts.unstable_opts.sanitizer_memory_track_origins != 0 + } + + pub fn is_sanitizer_thread_enabled(&self) -> bool { + self.opts.cg.sanitize.contains(SanitizerSet::THREAD) } pub fn is_split_lto_unit_enabled(&self) -> bool { @@ -533,7 +561,10 @@ impl Session { // AddressSanitizer and KernelAddressSanitizer uses lifetimes to detect use after scope bugs. // MemorySanitizer uses lifetimes to detect use of uninitialized stack variables. // HWAddressSanitizer will use lifetimes to detect use after scope bugs in the future. - || self.opts.unstable_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::KERNELADDRESS | SanitizerSet::MEMORY | SanitizerSet::HWADDRESS) + || self.is_sanitizer_address_enabled() + || self.is_sanitizer_kernel_address_enabled() + || self.is_sanitizer_memory_enabled() + || self.is_sanitizer_hwaddress_enabled() } pub fn diagnostic_width(&self) -> usize { @@ -683,7 +714,7 @@ impl Session { let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly) || self.opts.output_types.contains_key(&OutputType::Bitcode) // AddressSanitizer and MemorySanitizer use alloca name when reporting an issue. - || self.opts.unstable_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY); + || self.is_sanitizer_address_enabled() || self.is_sanitizer_memory_enabled(); !more_names } } @@ -1187,14 +1218,19 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } - // Sanitizers can only be used on platforms that we know have working sanitizer codegen. - let supported_sanitizers = sess.target.options.supported_sanitizers; - let mut unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers; + let supported_sanitizers = if sess.unstable_options() { + sess.target.options.supported_sanitizers | sess.target.options.stable_sanitizers + } else { + sess.target.options.stable_sanitizers + }; + let mut unsupported_sanitizers = sess.opts.cg.sanitize - supported_sanitizers; + // Niche: if `fixed-x18`, or effectively switching on `reserved-x18` flag, is enabled // we should allow Shadow Call Stack sanitizer. if sess.opts.unstable_opts.fixed_x18 && sess.target.arch == "aarch64" { unsupported_sanitizers -= SanitizerSet::SHADOWCALLSTACK; } + match unsupported_sanitizers.into_iter().count() { 0 => {} 1 => { @@ -1209,7 +1245,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } // Cannot mix and match mutually-exclusive sanitizers. - if let Some((first, second)) = sess.opts.unstable_opts.sanitizer.mutually_exclusive() { + if let Some((first, second)) = sess.opts.cg.sanitize.mutually_exclusive() { sess.dcx().emit_err(errors::CannotMixAndMatchSanitizers { first: first.to_string(), second: second.to_string(), @@ -1217,10 +1253,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } // Cannot enable crt-static with sanitizers on Linux - if sess.crt_static(None) - && !sess.opts.unstable_opts.sanitizer.is_empty() - && !sess.target.is_like_msvc - { + if sess.crt_static(None) && !sess.opts.cg.sanitize.is_empty() && !sess.target.is_like_msvc { sess.dcx().emit_err(errors::CannotEnableCrtStaticLinux); } diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index f236be92b3b60..b7dce56ebff79 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -7,12 +7,12 @@ use super::crt_objects::CrtObjects; use super::{ BinaryFormat, CodeModel, DebuginfoKind, FloatAbi, FramePointer, LinkArgsCli, LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor, - MergeFunctions, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet, + MergeFunctions, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target, TargetKind, TargetOptions, TargetWarnings, TlsModel, }; use crate::json::{Json, ToJson}; -use crate::spec::AbiMap; +use crate::spec::{AbiMap, SanitizerSet}; impl Target { /// Loads a target descriptor from a JSON object. @@ -392,6 +392,7 @@ impl ToJson for Target { target_option_val!(split_debuginfo); target_option_val!(supported_split_debuginfo); target_option_val!(supported_sanitizers); + target_option_val!(stable_sanitizers); target_option_val!(c_enum_min_bits); target_option_val!(generate_arange_section); target_option_val!(supports_stack_protector); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 2f7109de804ae..23fb06a11a288 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1231,6 +1231,37 @@ impl SanitizerSet { }) } + pub fn from_comma_list(s: &str) -> Result { + let mut sanitizer_set = SanitizerSet::empty(); + for name in s.split(',') { + sanitizer_set |= match name { + "address" => SanitizerSet::ADDRESS, + "cfi" => SanitizerSet::CFI, + "dataflow" => SanitizerSet::DATAFLOW, + "kcfi" => SanitizerSet::KCFI, + "kernel-address" => SanitizerSet::KERNELADDRESS, + "leak" => SanitizerSet::LEAK, + "memory" => SanitizerSet::MEMORY, + "memtag" => SanitizerSet::MEMTAG, + "safestack" => SanitizerSet::SAFESTACK, + "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, + "thread" => SanitizerSet::THREAD, + "hwaddress" => SanitizerSet::HWADDRESS, + _ => return Err(format!("Unknown sanitizer {}", name)), + }; + } + return Ok(sanitizer_set); + } + + // fn from_json(json: &Json) -> Result { + // if let Some(array) = json.as_array() { + // let s: String = array.iter().filter_map(|v| v.as_str()).collect::>().join(","); + // return Self::from_comma_list(&s); + // } else { + // return Err("Expected a list of sanitizers".to_string()); + // } + // } + pub fn mutually_exclusive(self) -> Option<(SanitizerSet, SanitizerSet)> { Self::MUTUALLY_EXCLUSIVE .into_iter() @@ -2319,6 +2350,9 @@ pub struct TargetOptions { /// distributed with the target, the sanitizer should still appear in this list for the target. pub supported_sanitizers: SanitizerSet, + /// The stable sanitizers supported by this target + pub stable_sanitizers: SanitizerSet, + /// Minimum number of bits in #[repr(C)] enum. Defaults to the size of c_int pub c_enum_min_bits: Option, @@ -2567,6 +2601,7 @@ impl Default for TargetOptions { // `Off` is supported by default, but targets can remove this manually, e.g. Windows. supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), supported_sanitizers: SanitizerSet::empty(), + stable_sanitizers: SanitizerSet::empty(), c_enum_min_bits: None, generate_arange_section: true, supports_stack_protector: true, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index e19604725559a..6ceaad75fb26f 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -21,6 +21,7 @@ pub(crate) fn target() -> Target { max_atomic_width: Some(128), // FIXME: The leak sanitizer currently fails the tests, see #88132. supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD, + stable_sanitizers: SanitizerSet::ADDRESS, supports_xray: true, ..opts }, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs index 4220d74dfc890..f984fdf3d6bd5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs @@ -25,12 +25,13 @@ pub(crate) fn target() -> Target { stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI + | SanitizerSet::HWADDRESS | SanitizerSet::KCFI | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::MEMTAG - | SanitizerSet::THREAD - | SanitizerSet::HWADDRESS, + | SanitizerSet::THREAD, + stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK, supports_xray: true, ..base::linux_gnu::opts() }, diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs index 6a95afa1d0d3c..816ab03a3fc6e 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs @@ -6,6 +6,7 @@ pub(crate) fn target() -> Target { base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; + base.stable_sanitizers = SanitizerSet::ADDRESS; base.add_pre_link_args( LinkerFlavor::Msvc(Lld::No), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs index c70c026f9f71e..53f53a098e9f0 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs @@ -19,6 +19,7 @@ pub(crate) fn target() -> Target { base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = SanitizerSet::ADDRESS; + base.stable_sanitizers = SanitizerSet::ADDRESS; base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); base.stack_probes = StackProbeType::Inline; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index 8892c50d84478..a4f52646113c0 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -22,6 +22,7 @@ pub(crate) fn target() -> Target { | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD, + stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK, supports_xray: true, ..opts }, diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs index d88aabaa6d336..b73ee3d2781d1 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs @@ -7,6 +7,7 @@ pub(crate) fn target() -> Target { base.plt_by_default = false; base.max_atomic_width = Some(128); base.supported_sanitizers = SanitizerSet::ADDRESS; + base.stable_sanitizers = SanitizerSet::ADDRESS; Target { llvm_target: "x86_64-pc-windows-msvc".into(), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs index 0c8353fad182f..cd9542ecafbb8 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs @@ -12,12 +12,13 @@ pub(crate) fn target() -> Target { base.static_position_independent_executables = true; base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI - | SanitizerSet::KCFI | SanitizerSet::DATAFLOW + | SanitizerSet::KCFI | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::SAFESTACK | SanitizerSet::THREAD; + base.stable_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK; base.supports_xray = true; // When we're asked to use the `rust-lld` linker by default, set the appropriate lld-using diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index a9ce738a01387..0db4c1676d2ca 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -25,6 +25,7 @@ - [Cargo Specifics](check-cfg/cargo-specifics.md) - [Remap source paths](remap-source-paths.md) - [Exploit Mitigations](exploit-mitigations.md) +- [Sanitizers](sanitizers.md) - [Symbol Mangling](symbol-mangling/index.md) - [v0 Symbol Format](symbol-mangling/v0.md) - [Contributing to `rustc`](contributing.md) diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 0e340de4daa27..ff21a9bc397e7 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -626,6 +626,49 @@ This is primarily useful for local development, to ensure that all the `dylib` d To set the rpath to a different value (which can be useful for distribution), `-Clink-arg` with a platform-specific linker argument can be used to set the rpath directly. +## sanitize + +Sanitizers are a set of compiler-based runtime error detection tools that +instrument programs to detect bugs during execution. They work by instrumenting +code at compile time and runtime to monitor program behavior and detect specific +classes of errors at runtime. Sanitizers enable precise, low-overhead runtime +bug detection, improving software reliability and security. + +This option allows for use of one or more of these sanitizers: + + * [AddressSanitizer + (ASan)](../sanitizers.md#addresssanitizer): + Detects memory errors (e.g., buffer overflows, use after free). + * [LeakSanitizer + (LSan)](../sanitizers.md#leaksanitizer): + Detects memory leaks either as part of AddressSanitizer or as a standalone + tool. + +These are the valid values for this option for targets that support one or more +of these sanitizers: + +| Target | Sanitizers | +|-----------------------------|-----------------| +| aarch64-apple-darwin | address | +| aarch64-unknown-linux-gnu | address, leak | +| i686-pc-windows-msvc | address | +| i686-unknown-linux-gnu | address | +| x86_64-apple-darwin | address, leak | +| x86_64-pc-windows-msvc | address | +| x86_64-unknown-linux-gnu | address, leak | + +The quality of the Sanitizers implementation and support varies across operating +systems and architectures, and relies heavily on LLVM implementation--they are +mostly implemented in and supported by LLVM. + +Using a different LLVM or runtime version than the one used by the Rust compiler +is not supported. Using Sanitizers in mixed-language binaries (also known as +“mixed binaries”) is supported when the same LLVM and runtime version is used by +all languages. + +For more information about the available sanitizers, see the [Sanitizers +chapter](../sanitizers.md). + ## save-temps This flag controls whether temporary files generated during compilation are diff --git a/src/doc/rustc/src/sanitizers.md b/src/doc/rustc/src/sanitizers.md new file mode 100644 index 0000000000000..80e085a17132d --- /dev/null +++ b/src/doc/rustc/src/sanitizers.md @@ -0,0 +1,96 @@ +# Sanitizers + +## Introduction + +Sanitizers are a set of compiler-based runtime error detection tools that +instrument programs to detect bugs during execution. They work by instrumenting +code at compile time and runtime to monitor program behavior and detect specific +classes of errors at runtime. Sanitizers enable precise, low-overhead runtime +bug detection, improving software reliability and security. + +This option allows for use of one or more of these sanitizers: + + * [AddressSanitizer (ASan)](#addresssanitizer): Detects memory errors (e.g., + buffer overflows, use after free). + * [LeakSanitizer (LSan)](#leaksanitizer): Detects memory leaks either as part + of AddressSanitizer or as a standalone tool. + +These are the valid values for this option for targets that support one or more +of these sanitizers: + +| Target | Sanitizers | +|-----------------------------|-----------------| +| aarch64-apple-darwin | address | +| aarch64-unknown-linux-gnu | address, leak | +| i686-pc-windows-msvc | address | +| i686-unknown-linux-gnu | address | +| x86_64-apple-darwin | address, leak | +| x86_64-pc-windows-msvc | address | +| x86_64-unknown-linux-gnu | address, leak | + +## AddressSanitizer + +AddressSanitizer (ASan) detects memory errors by instrumenting code at compile +time and runtime to mark regions around allocated memory (i.e., red zones) as +unaddressable (i.e., poisoned), quarantine and mark deallocated memory as +unaddressable, and add checks before memory accesses. It uses a shadow memory +mapping to store metadata information about whether a memory region is +addressable. It can detect: + +* Heap-based buffer overflows, Stack-based buffer overflows, and other variants + of out-of-bounds reads and writes. +* Use after free, double free, and other variants of expired pointer dereference + (also known as “dangling pointer”). +* Initialization order bugs (such as [“Static Initialization Order + Fiasco”](https://en.cppreference.com/w/cpp/language/siof)). +* Memory leaks. + +AddressSanitizer uses both instrumentation at compile time and runtime. It is +recommended to recompile all code using AddressSanitizer for best results. If +parts of the compiled code are not instrumented, AddressSanitizer may not detect +certain memory errors or detect false positives. + +AddressSanitizer increases memory usage and also impacts performance due to the +red zones and shadow memory mapping, and the added checks before memory +accesses. AddressSanitizer and its runtime are not suitable for production use. + +For more information, see the [AddressSanitizer +documentation](https://clang.llvm.org/docs/AddressSanitizer.html). + +## LeakSanitizer + +LeakSanitizer (LSan) detects memory leaks either as part of AddressSanitizer or +as a standalone tool by instrumenting code at runtime to track all memory and +thread management functions (i.e., interceptors), and searching for memory that +remain allocated but are no longer reachable by any references in the program, +at program termination or during specific checkpoints. + +LeakSanitizer can detect: + +* Memory allocated dynamically (e.g., via `malloc`, `new`) that are not freed or + deleted and is no longer referenced in the program (i.e., directly leaked + memory). +* Memory allocated dynamically that is referenced by another memory that are not + freed or deleted and is no longer referenced in the program (i.e., indirectly + leaked memory). + +LeakSanitizer does not use instrumentation at compile time and works without +recompiling all code using LeakSanitizer. + +LeakSanitizer impacts performance due to the interceptors and the checks for +memory leaks at program termination. LeakSanitizer and its runtime are not +suitable for production use. + +For more information, see the [LeakSanitizer +documentation](https://clang.llvm.org/docs/LeakSanitizer.html). + +## Disclaimer + +The quality of the Sanitizers implementation and support varies across operating +systems and architectures, and relies heavily on LLVM implementation--they are +mostly implemented in and supported by LLVM. + +Using a different LLVM or runtime version than the one used by the Rust compiler +is not supported. Using Sanitizers in mixed-language binaries (also known as +“mixed binaries”) is supported when the same LLVM and runtime version is used by +all languages. diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 65db816ad1a87..2aa335c97471c 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -1076,7 +1076,9 @@ pub struct TargetCfg { #[serde(default)] pub(crate) dynamic_linking: bool, #[serde(rename = "supported-sanitizers", default)] - pub(crate) sanitizers: Vec, + pub(crate) supported_sanitizers: Vec, + #[serde(rename = "stable-sanitizers", default)] + pub(crate) stable_sanitizers: Vec, #[serde(rename = "supports-xray", default)] pub(crate) xray: bool, #[serde(default = "default_reloc_model")] diff --git a/src/tools/compiletest/src/directives/needs.rs b/src/tools/compiletest/src/directives/needs.rs index 5e9fe59d8d1c3..ecdb736a2f192 100644 --- a/src/tools/compiletest/src/directives/needs.rs +++ b/src/tools/compiletest/src/directives/needs.rs @@ -40,8 +40,8 @@ pub(super) fn handle_needs( ignore_reason: "ignored on targets without kernel CFI sanitizer", }, Need { - name: "needs-sanitizer-kasan", - condition: cache.sanitizer_kasan, + name: "needs-sanitizer-kernel-address", + condition: cache.sanitizer_kernel_address, ignore_reason: "ignored on targets without kernel address sanitizer", }, Need { @@ -314,7 +314,7 @@ pub(super) struct CachedNeedsConditions { sanitizer_cfi: bool, sanitizer_dataflow: bool, sanitizer_kcfi: bool, - sanitizer_kasan: bool, + sanitizer_kernel_address: bool, sanitizer_leak: bool, sanitizer_memory: bool, sanitizer_thread: bool, @@ -333,14 +333,18 @@ pub(super) struct CachedNeedsConditions { impl CachedNeedsConditions { pub(super) fn load(config: &Config) -> Self { let target = &&*config.target; - let sanitizers = &config.target_cfg().sanitizers; + let sanitizers = [ + config.target_cfg().supported_sanitizers.clone(), + config.target_cfg().stable_sanitizers.clone(), + ] + .concat(); Self { sanitizer_support: std::env::var_os("RUSTC_SANITIZER_SUPPORT").is_some(), sanitizer_address: sanitizers.contains(&Sanitizer::Address), sanitizer_cfi: sanitizers.contains(&Sanitizer::Cfi), sanitizer_dataflow: sanitizers.contains(&Sanitizer::Dataflow), sanitizer_kcfi: sanitizers.contains(&Sanitizer::Kcfi), - sanitizer_kasan: sanitizers.contains(&Sanitizer::KernelAddress), + sanitizer_kernel_address: sanitizers.contains(&Sanitizer::KernelAddress), sanitizer_leak: sanitizers.contains(&Sanitizer::Leak), sanitizer_memory: sanitizers.contains(&Sanitizer::Memory), sanitizer_thread: sanitizers.contains(&Sanitizer::Thread), diff --git a/tests/codegen-llvm/naked-asan.rs b/tests/codegen-llvm/naked-asan.rs index a57e55d1366c3..999d7105720c2 100644 --- a/tests/codegen-llvm/naked-asan.rs +++ b/tests/codegen-llvm/naked-asan.rs @@ -1,8 +1,9 @@ +// Make sure we do not request sanitizers for naked functions. //@ add-core-stubs +//@ only-x86_64 //@ needs-llvm-components: x86 -//@ compile-flags: --target x86_64-unknown-linux-gnu -Zsanitizer=address -Ctarget-feature=-crt-static - -// Make sure we do not request sanitizers for naked functions. +//@ needs-sanitizer-address +//@ compile-flags: --target x86_64-unknown-linux-gnu -Zunstable-options -Csanitize=address -Ctarget-feature=-crt-static #![crate_type = "lib"] #![feature(no_core)] diff --git a/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs index e1d7dc2d631f0..35e10b268ad04 100644 --- a/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs +++ b/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs @@ -1,9 +1,10 @@ //@ add-core-stubs //@ revisions: aarch64 android -//@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack +//@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 //@[aarch64] needs-llvm-components: aarch64 -//@[android] compile-flags: --target aarch64-linux-android -Zsanitizer=shadow-call-stack +//@[android] compile-flags: --target aarch64-linux-android //@[android] needs-llvm-components: aarch64 +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=shadow-call-stack #![allow(internal_features)] #![crate_type = "rlib"] diff --git a/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs index ada525b6c8033..21722c9f2732c 100644 --- a/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs +++ b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs @@ -19,9 +19,9 @@ //@ only-linux // //@ revisions:ASAN ASAN-FAT-LTO -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -// [ASAN] no extra compile-flags -//@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize +//@[ASAN] compile-flags: -Zunstable-options -Csanitize=address +//@[ASAN-FAT-LTO] compile-flags: -Clto=fat -Cprefer-dynamic=false -Zunstable-options -Csanitize=address #![crate_type = "staticlib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs index 77857ca4ccb9e..6c2df5427abd3 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs @@ -1,7 +1,7 @@ // Verifies that "CFI Canonical Jump Tables" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs index 6cf9a72b7488d..fdca97c796f80 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs @@ -1,7 +1,7 @@ // Verifies that "cfi-normalize-integers" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs index 0bfdbfba5d2e2..94ebe5e595f62 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs @@ -1,7 +1,7 @@ // Verifies that "EnableSplitLTOUnit" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs b/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs index 2a18e30e2b0de..c6d811df07b20 100644 --- a/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs +++ b/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs @@ -1,7 +1,7 @@ // Verifies that the parent block's debug information are assigned to the inserted cfi block. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Cdebuginfo=1 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs index c49438f43186f..d04a7195dc951 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs @@ -1,7 +1,7 @@ // Verifies that pointer type membership tests for indirect calls are omitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs index 9cad88f651820..e4f727108edb9 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs @@ -1,7 +1,7 @@ // Verifies that pointer type membership tests for indirect calls are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs index cd9088f58af4a..f3a4f0315a4b6 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs @@ -1,7 +1,7 @@ // Verifies that user-defined CFI encoding for types are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(cfi_encoding, extern_types)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs index cf26c17af1ed3..c4c2d5737b6d1 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs @@ -2,7 +2,7 @@ // for const generics. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs index 279350d20c5f0..1f694d012a84b 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs @@ -5,7 +5,7 @@ // future. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs index 047b532e994ea..6d6e9abe06d18 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs @@ -2,7 +2,7 @@ // for function types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs index 92b2ab32ea036..564c3ba221b5a 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs @@ -2,7 +2,7 @@ // for lifetimes/regions. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs index 5de39dc85c17e..8f8987dbc2688 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs @@ -2,7 +2,7 @@ // self so they can be used as function pointers. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs index f5846713bd531..ae06c784a8796 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs @@ -2,7 +2,7 @@ // for paths. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs index ad4fe11d08723..bf8311d347fdc 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs @@ -2,7 +2,7 @@ // for pointer types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs index 93845d0519541..4df8cf5cf1da5 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs @@ -2,7 +2,7 @@ // for primitive types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs index 025aa902658ec..c96a7c31c1bed 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs @@ -2,7 +2,7 @@ // for repr transparent types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs index 76c8150b77859..b7175c993c842 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs @@ -2,7 +2,7 @@ // for sequence types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs index 4fafdd2f040fc..487049a892220 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs @@ -2,7 +2,7 @@ // for trait types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs index 91351096ca201..e480fbf4be343 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs @@ -2,7 +2,7 @@ // for user-defined types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] #![feature(extern_types)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs index 22d518cca7442..ec324193ff34f 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs @@ -1,7 +1,7 @@ // Verifies that generalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-generalize-pointers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs index 7639ce7b10448..1710b8d8341ce 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs @@ -1,7 +1,7 @@ // Verifies that normalized and generalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs index acd72b0ca3cff..ad12b3e51728a 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs @@ -1,7 +1,7 @@ // Verifies that normalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs index fa5cd471466e2..64b13cdac5cd2 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs @@ -1,7 +1,7 @@ // Verifies that type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs index 82873e935b292..a5a0a07795c48 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs @@ -1,7 +1,7 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs index 893b016769368..7cb8b037249e0 100644 --- a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs +++ b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs @@ -2,7 +2,8 @@ // emitted correctly. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi + #![crate_type = "bin"] #![feature(linkage)] diff --git a/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs b/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs index caa2f258f8f2a..74a2575f0cbc9 100644 --- a/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs +++ b/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs @@ -1,7 +1,7 @@ // Verifies that pointer types are generalized. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-generalize-pointers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs b/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs index 16f76adafb826..afb70ec1af16c 100644 --- a/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs +++ b/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs @@ -1,7 +1,7 @@ // Verifies that integer types are normalized. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs b/tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs index cd8c2c48ea4f7..e1abc18c69e08 100644 --- a/tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs +++ b/tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs @@ -1,7 +1,7 @@ // Verifies that functions are instrumented. // //@ needs-sanitizer-dataflow -//@ compile-flags: -Copt-level=0 -Zsanitizer=dataflow -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Copt-level=0 -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=dataflow #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs index c70aae1703eff..8c46492f01b0b 100644 --- a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs @@ -1,7 +1,6 @@ -// Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. +// Verifies that `-Csanitize=kernel-address` emits sanitizer instrumentation. //@ add-core-stubs -//@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 @@ -11,6 +10,7 @@ //@[riscv64gc] needs-llvm-components: riscv //@[x86_64] compile-flags: --target x86_64-unknown-none //@[x86_64] needs-llvm-components: x86 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kernel-address #![crate_type = "rlib"] #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs index 0be1ff1977492..583331d343ed1 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs @@ -6,7 +6,7 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-normalize-integers #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs index 9a2290901d641..bef8a3f13dd8b 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs @@ -4,7 +4,7 @@ //@ revisions: x86_64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cpanic=abort -Zunstable-options -Csanitize=kcfi -Zsanitizer-kcfi-arity -Cunsafe-allow-abi-mismatch=sanitize //@ min-llvm-version: 21.0.0 #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs index eabe0409c9a33..fb88bc1d407fd 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs @@ -6,7 +6,7 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs index 2f18c9d84b90f..361f61cc9174e 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs @@ -6,7 +6,7 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Z patchable-function-entry=4,3 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zpatchable-function-entry=4,3 #![feature(no_core, lang_items, patchable_function_entry)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs index 2581784ce3ee1..e7728cdfbcb4e 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![crate_type = "lib"] #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index 9a60d51713f56..1b19a41811374 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-generalize-pointers #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index 134f4ff4bfd9a..7de925a7d05f8 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index 4328b7fa07dff..e69bfbde514a5 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-normalize-integers #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 81a9db1b97a57..e57d7ee62bb4c 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs index 61056c2a54e7b..236bdcd1a4ed3 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index 182af162d7824..2ee9c493110fa 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -5,8 +5,8 @@ //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none -//@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ [x86_64] needs-llvm-components: x86_64 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![crate_type = "lib"] #![feature(arbitrary_self_types, no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs index 2c8cdc919b85d..8a0345765ee8b 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs @@ -4,7 +4,7 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/memory-track-origins.rs b/tests/codegen-llvm/sanitizer/memory-track-origins.rs index a72e523c4e193..9cf5d1cb8fbd9 100644 --- a/tests/codegen-llvm/sanitizer/memory-track-origins.rs +++ b/tests/codegen-llvm/sanitizer/memory-track-origins.rs @@ -3,13 +3,12 @@ // //@ needs-sanitizer-memory //@ revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO -// -//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -// [MSAN-0] no extra compile-flags -//@[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1 -//@[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins -//@[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat -//@[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat +//@[MSAN-0] compile-flags: -Zunstable-options -Csanitize=memory +//@[MSAN-1] compile-flags: -Zunstable-options -Csanitize=memory -Zsanitizer-memory-track-origins=1 +//@[MSAN-2] compile-flags: -Zunstable-options -Csanitize=memory -Zsanitizer-memory-track-origins +//@[MSAN-1-LTO] compile-flags: -Clto=fat -Zunstable-options -Csanitize=memory -Zsanitizer-memory-track-origins=1 +//@[MSAN-2-LTO] compile-flags: -Clto=fat -Zunstable-options -Csanitize=memory -Zsanitizer-memory-track-origins +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/memtag-attr-check.rs b/tests/codegen-llvm/sanitizer/memtag-attr-check.rs index fc430f3a57003..dcd5f181a891b 100644 --- a/tests/codegen-llvm/sanitizer/memtag-attr-check.rs +++ b/tests/codegen-llvm/sanitizer/memtag-attr-check.rs @@ -2,7 +2,7 @@ // applied when enabling the memtag sanitizer. // //@ needs-sanitizer-memtag -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0 +//@ compile-flags: -Ctarget-feature=+mte -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=memtag #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs index 945e46218d04a..85a38bc513e0e 100644 --- a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs +++ b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs @@ -1,5 +1,5 @@ //@ add-core-stubs -//@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack +//@ compile-flags: --target riscv64imac-unknown-none-elf -Copt-level=0 -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=shadow-call-stack //@ needs-llvm-components: riscv #![allow(internal_features)] diff --git a/tests/codegen-llvm/sanitizer/safestack-attr-check.rs b/tests/codegen-llvm/sanitizer/safestack-attr-check.rs index 414dd89a58072..c4c22db775414 100644 --- a/tests/codegen-llvm/sanitizer/safestack-attr-check.rs +++ b/tests/codegen-llvm/sanitizer/safestack-attr-check.rs @@ -1,7 +1,7 @@ // This tests that the safestack attribute is applied when enabling the safe-stack sanitizer. // //@ needs-sanitizer-safestack -//@ compile-flags: -Zsanitizer=safestack -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Copt-level=0 -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=safestack #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs index 37549aba4477b..19342e405a4a6 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs @@ -2,7 +2,6 @@ // the kernel address sanitizer. // //@ add-core-stubs -//@ compile-flags: -Zsanitizer=kernel-address -Ctarget-feature=-crt-static -Copt-level=0 //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 @@ -12,6 +11,7 @@ //@[riscv64gc] needs-llvm-components: riscv //@[x86_64] compile-flags: --target x86_64-unknown-none //@[x86_64] needs-llvm-components: x86 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kernel-address #![crate_type = "rlib"] #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs index 0f43e6b8393dd..7a63c253e6e27 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs @@ -3,10 +3,10 @@ //@ needs-sanitizer-address //@ needs-sanitizer-leak //@ revisions: ASAN LSAN -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -//@ compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static -//@[ASAN] compile-flags: -Zsanitizer=address -//@[LSAN] compile-flags: -Zsanitizer=leak +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize +//@ compile-flags: -Copt-level=3 -Zmir-opt-level=4 +//@[ASAN] compile-flags: -Zunstable-options -Csanitize=address +//@[LSAN] compile-flags: -Zunstable-options -Csanitize=leak #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs index 61ad0ba7d90d3..d978aaa4f7cf4 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs @@ -2,7 +2,7 @@ // the address sanitizer. // //@ needs-sanitizer-address -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off.rs b/tests/codegen-llvm/sanitizer/sanitize-off.rs index 9f3f7cd9df781..6fe2760775428 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off.rs @@ -2,7 +2,7 @@ // selectively disable sanitizer instrumentation. // //@ needs-sanitizer-address -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 +//@ compile-flags: -Copt-level=0 -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitizer-recover.rs b/tests/codegen-llvm/sanitizer/sanitizer-recover.rs index b8a24e31c30bb..27ab1e2b16c59 100644 --- a/tests/codegen-llvm/sanitizer/sanitizer-recover.rs +++ b/tests/codegen-llvm/sanitizer/sanitizer-recover.rs @@ -5,13 +5,17 @@ //@ needs-sanitizer-memory //@ revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO //@ no-prefer-dynamic -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer //@ compile-flags: -Ctarget-feature=-crt-static -//@[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0 -//@[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0 -//@[MSAN] compile-flags: -Zsanitizer=memory -//@[MSAN-RECOVER] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -//@[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -C lto=fat +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize +//@[ASAN] compile-flags: -Zunstable-options -Csanitize=address +//@[ASAN] compile-flags: -Copt-level=0 +//@[ASAN-RECOVER] compile-flags: -Zunstable-options -Csanitize=address +//@[ASAN-RECOVER] compile-flags: -Zsanitizer-recover=address -Copt-level=0 +//@[MSAN] compile-flags: -Zunstable-options -Csanitize=memory +//@[MSAN-RECOVER] compile-flags: -Zunstable-options -Csanitize=memory +//@[MSAN-RECOVER] compile-flags: -Zsanitizer-recover=memory +//@[MSAN-RECOVER-LTO] compile-flags: -Zunstable-options -Csanitize=memory +//@[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer-recover=memory -Clto=fat // // MSAN-NOT: @__msan_keep_going // MSAN-RECOVER: @__msan_keep_going = weak_odr {{.*}}constant i32 1 diff --git a/tests/codegen-llvm/sanitizer/scs-attr-check.rs b/tests/codegen-llvm/sanitizer/scs-attr-check.rs index f726503503c96..a5370ff075e48 100644 --- a/tests/codegen-llvm/sanitizer/scs-attr-check.rs +++ b/tests/codegen-llvm/sanitizer/scs-attr-check.rs @@ -2,7 +2,7 @@ // applied when enabling the shadow-call-stack sanitizer. // //@ needs-sanitizer-shadow-call-stack -//@ compile-flags: -Zsanitizer=shadow-call-stack +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=shadow-call-stack #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs index b3bd0666ab21f..6a2e30f1730fe 100644 --- a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs +++ b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --target aarch64-unknown-none -Zsanitizer=shadow-call-stack +//@ compile-flags: --target aarch64-unknown-none -Zunstable-options -Csanitize=shadow-call-stack //@ dont-check-compiler-stderr //@ needs-llvm-components: aarch64 diff --git a/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs index 94dab4235e093..93cbb81501067 100644 --- a/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs +++ b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs @@ -10,7 +10,7 @@ //@[instrument] only-linux // Make sure we don't try to CFI encode it. -//@[cfi] compile-flags: -Zsanitizer=cfi -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Clink-dead-code=true +//@[cfi] compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zunstable-options -Csanitize=cfi -Clink-dead-code=true //@[cfi] needs-sanitizer-cfi //@[cfi] no-prefer-dynamic // FIXME(#122848) Remove only-linux once OSX CFI binaries work diff --git a/tests/ui/lto/issue-100772.rs b/tests/ui/lto/issue-100772.rs index e07d44e3be880..443609e3a2d23 100644 --- a/tests/ui/lto/issue-100772.rs +++ b/tests/ui/lto/issue-100772.rs @@ -1,6 +1,10 @@ //@ build-pass //@ needs-sanitizer-cfi +<<<<<<< HEAD //@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +======= +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zunstable-options -Csanitize=cfi +>>>>>>> 832830ac5a0 (sanitizers: Add support for stable sanitizers) //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/address.rs b/tests/ui/sanitizer/address.rs index 1688f46c2d556..4a24ff579f185 100644 --- a/tests/ui/sanitizer/address.rs +++ b/tests/ui/sanitizer/address.rs @@ -2,7 +2,7 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -Z sanitizer=address -O -g -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address -O -g // //@ run-fail-or-crash //@ error-pattern: AddressSanitizer: stack-buffer-overflow diff --git a/tests/ui/sanitizer/asan_odr_windows.rs b/tests/ui/sanitizer/asan_odr_windows.rs index b638d6eb9694c..74ceddd40916d 100644 --- a/tests/ui/sanitizer/asan_odr_windows.rs +++ b/tests/ui/sanitizer/asan_odr_windows.rs @@ -2,7 +2,7 @@ //! See . //@ run-pass -//@ compile-flags:-Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address //@ aux-build: asan_odr_win-2.rs //@ only-windows-msvc //@ needs-sanitizer-support diff --git a/tests/ui/sanitizer/auxiliary/asan_odr_win-2.rs b/tests/ui/sanitizer/auxiliary/asan_odr_win-2.rs index 75488a29e5e0d..fcdfc11934480 100644 --- a/tests/ui/sanitizer/auxiliary/asan_odr_win-2.rs +++ b/tests/ui/sanitizer/auxiliary/asan_odr_win-2.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: -Z sanitizer=address +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Zsanitizer=address #![crate_name = "othercrate"] #![crate_type = "rlib"] diff --git a/tests/ui/sanitizer/badfree.rs b/tests/ui/sanitizer/badfree.rs index b1b02649dccdc..4241aa5e68e2b 100644 --- a/tests/ui/sanitizer/badfree.rs +++ b/tests/ui/sanitizer/badfree.rs @@ -2,7 +2,7 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -Z sanitizer=address -O -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address -O // //@ run-fail-or-crash //@ regex-error-pattern: AddressSanitizer: (SEGV|attempting free on address which was not malloc) diff --git a/tests/ui/sanitizer/cfg-kasan.rs b/tests/ui/sanitizer/cfg-kasan.rs index ba0abf605707a..4f3a26bf33dfe 100644 --- a/tests/ui/sanitizer/cfg-kasan.rs +++ b/tests/ui/sanitizer/cfg-kasan.rs @@ -1,9 +1,8 @@ -// Verifies that when compiling with -Zsanitizer=kernel-address, +// Verifies that when compiling with -Csanitize=kernel-address, // the `#[cfg(sanitize = "address")]` attribute is configured. //@ add-core-stubs //@ check-pass -//@ compile-flags: -Zsanitizer=kernel-address //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 @@ -13,6 +12,7 @@ //@[riscv64gc] needs-llvm-components: riscv //@[x86_64] compile-flags: --target x86_64-unknown-none //@[x86_64] needs-llvm-components: x86 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kernel-address #![crate_type = "rlib"] #![feature(cfg_sanitize, no_core, lang_items)] diff --git a/tests/ui/sanitizer/cfg.rs b/tests/ui/sanitizer/cfg.rs index a43813c04469f..f324144191ea6 100644 --- a/tests/ui/sanitizer/cfg.rs +++ b/tests/ui/sanitizer/cfg.rs @@ -1,24 +1,24 @@ -// Verifies that when compiling with -Zsanitizer=option, +// Verifies that when compiling with -Csanitize=option, // the `#[cfg(sanitize = "option")]` attribute is configured. //@ add-core-stubs //@ check-pass //@ revisions: address cfi kcfi leak memory thread -//@compile-flags: -Ctarget-feature=-crt-static //@[address]needs-sanitizer-address -//@[address]compile-flags: -Zsanitizer=address +//@[address]compile-flags: -Zunstable-options -Csanitize=address //@[cfi]needs-sanitizer-cfi -//@[cfi]compile-flags: -Zsanitizer=cfi +//@[cfi]compile-flags: -Zunstable-options -Csanitize=cfi //@[cfi]compile-flags: -Clto -Ccodegen-units=1 //@[kcfi]needs-llvm-components: x86 -//@[kcfi]compile-flags: -Zsanitizer=kcfi --target x86_64-unknown-none -//@[kcfi]compile-flags: -C panic=abort +//@[kcfi]compile-flags: -Zunstable-options -Csanitize=kcfi +//@[kcfi]compile-flags: --target x86_64-unknown-none -C panic=abort //@[leak]needs-sanitizer-leak -//@[leak]compile-flags: -Zsanitizer=leak +//@[leak]compile-flags: -Zunstable-options -Csanitize=leak //@[memory]needs-sanitizer-memory -//@[memory]compile-flags: -Zsanitizer=memory +//@[memory]compile-flags: -Zunstable-options -Csanitize=memory //@[thread]needs-sanitizer-thread -//@[thread]compile-flags: -Zsanitizer=thread +//@[thread]compile-flags: -Zunstable-options -Csanitize=thread +//@compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize #![feature(cfg_sanitize, no_core, lang_items)] #![crate_type="lib"] diff --git a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs index 5de5e99f6d0cc..5d6165a4fc316 100644 --- a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs +++ b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs @@ -2,7 +2,7 @@ // trait object type to fail, causing an ICE. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ edition: 2021 //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu diff --git a/tests/ui/sanitizer/cfi/async-closures.rs b/tests/ui/sanitizer/cfi/async-closures.rs index 621a0882c91b2..2236f86880a6a 100644 --- a/tests/ui/sanitizer/cfi/async-closures.rs +++ b/tests/ui/sanitizer/cfi/async-closures.rs @@ -7,11 +7,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Zpanic-abort-tests -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass #![feature(async_fn_traits)] diff --git a/tests/ui/sanitizer/cfi/can-reveal-opaques.rs b/tests/ui/sanitizer/cfi/can-reveal-opaques.rs index 310ce04c55240..6936fec1bb7ac 100644 --- a/tests/ui/sanitizer/cfi/can-reveal-opaques.rs +++ b/tests/ui/sanitizer/cfi/can-reveal-opaques.rs @@ -1,5 +1,5 @@ //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs index 36f6e3bc95e18..b1ca292c9fa6b 100644 --- a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs @@ -1,10 +1,10 @@ -// Verifies that `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`. +// Verifies that `-Zsanitizer-cfi-canonical-jump-tables` requires `-Csanitize=cfi`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-cfi-canonical-jump-tables=false +//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer-cfi-canonical-jump-tables=false #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` +//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Csanitize=cfi` diff --git a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr index de67d6a6b7f06..95f120c360b7c 100644 --- a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` +error: `-Zsanitizer-cfi-canonical-jump-tables` requires `-Csanitize=cfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/closures.rs b/tests/ui/sanitizer/cfi/closures.rs index 7493dba4928b0..e1e919fc707a9 100644 --- a/tests/ui/sanitizer/cfi/closures.rs +++ b/tests/ui/sanitizer/cfi/closures.rs @@ -6,11 +6,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Zpanic-abort-tests -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ compile-flags: --test //@ run-pass diff --git a/tests/ui/sanitizer/cfi/complex-receiver.rs b/tests/ui/sanitizer/cfi/complex-receiver.rs index adacc0d6c5df7..1efbd1121c163 100644 --- a/tests/ui/sanitizer/cfi/complex-receiver.rs +++ b/tests/ui/sanitizer/cfi/complex-receiver.rs @@ -8,11 +8,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass use std::sync::Arc; diff --git a/tests/ui/sanitizer/cfi/coroutine.rs b/tests/ui/sanitizer/cfi/coroutine.rs index d85615b597de2..9112e7e5a381d 100644 --- a/tests/ui/sanitizer/cfi/coroutine.rs +++ b/tests/ui/sanitizer/cfi/coroutine.rs @@ -7,12 +7,11 @@ //@ edition: 2024 //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Zpanic-abort-tests -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ compile-flags: --test //@ run-pass diff --git a/tests/ui/sanitizer/cfi/drop-in-place.rs b/tests/ui/sanitizer/cfi/drop-in-place.rs index fe59d54631248..c2dc576defa67 100644 --- a/tests/ui/sanitizer/cfi/drop-in-place.rs +++ b/tests/ui/sanitizer/cfi/drop-in-place.rs @@ -4,8 +4,7 @@ //@ only-linux //@ ignore-backends: gcc //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ run-pass struct EmptyDrop; diff --git a/tests/ui/sanitizer/cfi/drop-no-principal.rs b/tests/ui/sanitizer/cfi/drop-no-principal.rs index 4fb905eb51d05..f21daed79a2ab 100644 --- a/tests/ui/sanitizer/cfi/drop-no-principal.rs +++ b/tests/ui/sanitizer/cfi/drop-no-principal.rs @@ -3,13 +3,8 @@ //@ needs-sanitizer-cfi // FIXME(#122848) Remove only-linux once OSX CFI binaries works //@ only-linux -//@ ignore-backends: gcc -//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer -//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0 -// FIXME(#118761) Should be run-pass once the labels on drop are compatible. -// This test is being landed ahead of that to test that the compiler doesn't ICE while labeling the -// callsite for a drop, but the vtable doesn't have the correct label yet. -//@ build-pass +//@ compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi +//@ run-pass struct CustomDrop; diff --git a/tests/ui/sanitizer/cfi/fn-ptr.rs b/tests/ui/sanitizer/cfi/fn-ptr.rs index bdb8c7ceb328c..c85ae7c11ba05 100644 --- a/tests/ui/sanitizer/cfi/fn-ptr.rs +++ b/tests/ui/sanitizer/cfi/fn-ptr.rs @@ -6,13 +6,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C opt-level=0 -C codegen-units=1 -C lto -//@ [cfi] compile-flags: -C prefer-dynamic=off -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass trait Foo { diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs b/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs index 44cdcb250e701..8caac6bad1a8b 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs +++ b/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs @@ -3,8 +3,7 @@ // //@ needs-sanitizer-cfi //@ check-pass -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-generalize-pointers #![feature(cfg_sanitizer_cfi)] diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs index 83277da528c96..d50bc5e0dc8e6 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs @@ -1,11 +1,11 @@ -// Verifies that `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or -// `-Zsanitizer=kcfi`. +// Verifies that `-Zsanitizer-cfi-generalize-pointers` requires `-Csanitize=cfi` or +// `-Csanitize=kcfi`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer-cfi-generalize-pointers #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr index 621708de241c2..4c76d27b879e2 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +error: `-Zsanitizer-cfi-generalize-pointers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs b/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs index 23ffabad62fe8..91d212f13defb 100644 --- a/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs +++ b/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs @@ -1,7 +1,7 @@ // Verifies that invalid user-defined CFI encodings can't be used. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-generalize-pointers #![feature(cfi_encoding, no_core)] #![no_core] diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr index 7f596a19104e6..8a9544f6c6afc 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr @@ -1,6 +1,6 @@ error: cfi sanitizer is not supported for this target -error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +error: `-Csanitize=cfi` is incompatible with `-Csanitize=kcfi` error: aborting due to 2 previous errors diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs index db8d11616440d..c2726b7e76e03 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs @@ -1,15 +1,15 @@ -// Verifies that `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`. +// Verifies that `-Csanitize=cfi` is incompatible with `-Csanitize=kcfi`. // //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer=kcfi +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Csanitize=kcfi #![feature(no_core)] #![no_core] #![no_main] //~? ERROR cfi sanitizer is not supported for this target -//~? ERROR `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +//~? ERROR `-Csanitize=cfi` is incompatible with `-Csanitize=kcfi` diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr index 7f596a19104e6..8a9544f6c6afc 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr @@ -1,6 +1,6 @@ error: cfi sanitizer is not supported for this target -error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +error: `-Csanitize=cfi` is incompatible with `-Csanitize=kcfi` error: aborting due to 2 previous errors diff --git a/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs b/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs index ce4e31eb69b5a..91fbae0990d97 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs +++ b/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs @@ -3,7 +3,7 @@ // //@ needs-sanitizer-cfi //@ check-pass -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi -Zsanitizer-cfi-normalize-integers #![feature(cfg_sanitizer_cfi)] diff --git a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs index b9d5b9623d5f0..aded63b8c04cb 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs @@ -1,11 +1,11 @@ -// Verifies that `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or -// `-Zsanitizer=kcfi` +// Verifies that `-Zsanitizer-cfi-normalize-integers` requires `-Csanitize=cfi` or +// `-Csanitize=kcfi` // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer-cfi-normalize-integers #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +//~? ERROR `-Zsanitizer-cfi-normalize-integers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` diff --git a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr index 748fb60dad92e..32e9c9f2cf67d 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +error: `-Zsanitizer-cfi-normalize-integers` requires `-Csanitize=cfi` or `-Csanitize=kcfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/requires-lto.rs b/tests/ui/sanitizer/cfi/requires-lto.rs index db83f5f6bf020..4243b28654e56 100644 --- a/tests/ui/sanitizer/cfi/requires-lto.rs +++ b/tests/ui/sanitizer/cfi/requires-lto.rs @@ -1,10 +1,10 @@ -// Verifies that `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`. +// Verifies that `-Csanitize=cfi` requires `-Clto` or `-Clinker-plugin-lto`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` +//~? ERROR `-Csanitize=cfi` requires `-Clto` or `-Clinker-plugin-lto` diff --git a/tests/ui/sanitizer/cfi/requires-lto.stderr b/tests/ui/sanitizer/cfi/requires-lto.stderr index efc0c43138e12..13d539e7c706b 100644 --- a/tests/ui/sanitizer/cfi/requires-lto.stderr +++ b/tests/ui/sanitizer/cfi/requires-lto.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` +error: `-Csanitize=cfi` requires `-Clto` or `-Clinker-plugin-lto` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/self-ref.rs b/tests/ui/sanitizer/cfi/self-ref.rs index 827610a261064..7fe30001aecd7 100644 --- a/tests/ui/sanitizer/cfi/self-ref.rs +++ b/tests/ui/sanitizer/cfi/self-ref.rs @@ -6,11 +6,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass use std::marker::PhantomData; diff --git a/tests/ui/sanitizer/cfi/sized-associated-ty.rs b/tests/ui/sanitizer/cfi/sized-associated-ty.rs index da8c385c6fc8b..a4761c9798455 100644 --- a/tests/ui/sanitizer/cfi/sized-associated-ty.rs +++ b/tests/ui/sanitizer/cfi/sized-associated-ty.rs @@ -7,11 +7,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass trait Foo { diff --git a/tests/ui/sanitizer/cfi/supertraits.rs b/tests/ui/sanitizer/cfi/supertraits.rs index b2782dff5d555..a6332e44ba4cb 100644 --- a/tests/ui/sanitizer/cfi/supertraits.rs +++ b/tests/ui/sanitizer/cfi/supertraits.rs @@ -6,11 +6,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass trait Parent1 { diff --git a/tests/ui/sanitizer/cfi/transparent-has-regions.rs b/tests/ui/sanitizer/cfi/transparent-has-regions.rs index 3e9893df23c92..acf071eb85fe8 100644 --- a/tests/ui/sanitizer/cfi/transparent-has-regions.rs +++ b/tests/ui/sanitizer/cfi/transparent-has-regions.rs @@ -1,5 +1,5 @@ //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ build-pass diff --git a/tests/ui/sanitizer/cfi/virtual-auto.rs b/tests/ui/sanitizer/cfi/virtual-auto.rs index d3a715c079aa6..a7eaf6f444128 100644 --- a/tests/ui/sanitizer/cfi/virtual-auto.rs +++ b/tests/ui/sanitizer/cfi/virtual-auto.rs @@ -6,11 +6,11 @@ //@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi -//@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi -//@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off +//@ [cfi] compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off +//@ [cfi] compile-flags: -Zunstable-options -Csanitize=cfi +//@ [kcfi] compile-flags: -Cpanic=abort -Cprefer-dynamic=off +//@ [kcfi] compile-flags: -Zunstable-options -Csanitize=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize //@ run-pass trait Foo { diff --git a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs index 4ef5b6756a495..8f7e2e949a9e4 100644 --- a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs +++ b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs @@ -1,10 +1,10 @@ -// Verifies that `-Zsanitizer=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`. +// Verifies that `-Csanitize=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` +//~? ERROR `-Csanitize=cfi` with `-Clto` requires `-Ccodegen-units=1` diff --git a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr index 8d6dc1d8f1ea4..76673871f6e13 100644 --- a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr +++ b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` +error: `-Csanitize=cfi` with `-Clto` requires `-Ccodegen-units=1` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/crt-static.rs b/tests/ui/sanitizer/crt-static.rs index b8bdf28351c3d..0ce63ff8ade02 100644 --- a/tests/ui/sanitizer/crt-static.rs +++ b/tests/ui/sanitizer/crt-static.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z sanitizer=address -C target-feature=+crt-static --target x86_64-unknown-linux-gnu +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address -Ctarget-feature=+crt-static --target x86_64-unknown-linux-gnu //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/ui/sanitizer/dataflow.rs b/tests/ui/sanitizer/dataflow.rs index d99a1a6ac2479..60826db1bf074 100644 --- a/tests/ui/sanitizer/dataflow.rs +++ b/tests/ui/sanitizer/dataflow.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-support //@ needs-sanitizer-dataflow //@ run-pass -//@ compile-flags: -Zsanitizer=dataflow -Zsanitizer-dataflow-abilist={{src-base}}/sanitizer/dataflow-abilist.txt -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=dataflow -Zsanitizer-dataflow-abilist={{src-base}}/sanitizer/dataflow-abilist.txt use std::mem::size_of; use std::os::raw::{c_int, c_long, c_void}; diff --git a/tests/ui/sanitizer/hwaddress.rs b/tests/ui/sanitizer/hwaddress.rs index 05fcab17506b9..91a39e172279d 100644 --- a/tests/ui/sanitizer/hwaddress.rs +++ b/tests/ui/sanitizer/hwaddress.rs @@ -5,7 +5,7 @@ //@ ignore-aarch64-unknown-linux-gnu // // FIXME(#83989): codegen-units=1 triggers linker errors on aarch64-gnu -//@ compile-flags: -Z sanitizer=hwaddress -O -g -C codegen-units=16 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=hwaddress -O -g -C codegen-units=16 // //@ run-fail //@ error-pattern: HWAddressSanitizer: tag-mismatch diff --git a/tests/ui/sanitizer/incompatible.rs b/tests/ui/sanitizer/incompatible.rs index c706a5a2e4e7b..fbe565a32002f 100644 --- a/tests/ui/sanitizer/incompatible.rs +++ b/tests/ui/sanitizer/incompatible.rs @@ -1,8 +1,8 @@ -//@ compile-flags: -Z sanitizer=address -Z sanitizer=memory --target x86_64-unknown-linux-gnu +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address -Csanitize=memory --target x86_64-unknown-linux-gnu //@ needs-llvm-components: x86 #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=address` is incompatible with `-Zsanitizer=memory` +//~? ERROR `-Csanitize=address` is incompatible with `-Csanitize=memory` diff --git a/tests/ui/sanitizer/incompatible.stderr b/tests/ui/sanitizer/incompatible.stderr index 4dff813ee1be6..9995fb36abfa6 100644 --- a/tests/ui/sanitizer/incompatible.stderr +++ b/tests/ui/sanitizer/incompatible.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=address` is incompatible with `-Zsanitizer=memory` +error: `-Csanitize=address` is incompatible with `-Csanitize=memory` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs b/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs index ac2b95b639820..70b4300a96ca8 100644 --- a/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs +++ b/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs @@ -2,7 +2,7 @@ // encode_ty and caused the compiler to ICE. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ edition: 2021 //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu diff --git a/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs b/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs index f7af2842ad613..3cc6c347d9afe 100644 --- a/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs +++ b/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs @@ -2,7 +2,7 @@ // was expecting array type lengths to be evaluated, this was causing an ICE. // //@ build-pass -//@ compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi //@ needs-sanitizer-cfi #![crate_type = "lib"] diff --git a/tests/ui/sanitizer/issue-72154-address-lifetime-markers.rs b/tests/ui/sanitizer/issue-72154-address-lifetime-markers.rs index edeb1b0bf946e..79c9ba4ea5770 100644 --- a/tests/ui/sanitizer/issue-72154-address-lifetime-markers.rs +++ b/tests/ui/sanitizer/issue-72154-address-lifetime-markers.rs @@ -7,7 +7,7 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -Copt-level=0 -Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Copt-level=0 -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address //@ run-pass pub struct Wrap { diff --git a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs index 12aabb3b86236..b35944d8692c3 100644 --- a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs +++ b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs @@ -1,9 +1,10 @@ // Verifies that `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`. // //@ needs-sanitizer-kcfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-kcfi-arity +//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer-kcfi-arity -//~? ERROR `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi` #![feature(no_core)] #![no_core] #![no_main] + +//~? ERROR `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi` diff --git a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs b/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs index 8a724b853e13a..98817a0cd0f31 100644 --- a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs +++ b/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs @@ -1,11 +1,12 @@ // Verifies that `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later. // //@ needs-sanitizer-kcfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity +//@ compile-flags: -Cpanic=abort -Ctarget-feature=-crt-static -Zunstable-options -Csanitize=kcfi -Zsanitizer-kcfi-arity //@ build-fail //@ max-llvm-major-version: 20 -//~? ERROR `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later. #![feature(no_core)] #![no_core] #![no_main] + +//~? ERROR `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later. diff --git a/tests/ui/sanitizer/kcfi-mangling.rs b/tests/ui/sanitizer/kcfi-mangling.rs index 371f34ba72af2..3ea91046a44c4 100644 --- a/tests/ui/sanitizer/kcfi-mangling.rs +++ b/tests/ui/sanitizer/kcfi-mangling.rs @@ -2,7 +2,7 @@ //@ needs-sanitizer-kcfi //@ no-prefer-dynamic -//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cpanic=abort -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Csymbol-mangling-version=v0 //@ build-pass //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/leak.rs b/tests/ui/sanitizer/leak.rs index 4ce3f7ab1b951..c5d2b78a5a06c 100644 --- a/tests/ui/sanitizer/leak.rs +++ b/tests/ui/sanitizer/leak.rs @@ -1,7 +1,7 @@ //@ needs-sanitizer-support //@ needs-sanitizer-leak // -//@ compile-flags: -Z sanitizer=leak -O -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=leak -O // //@ run-fail //@ error-pattern: LeakSanitizer: detected memory leaks diff --git a/tests/ui/sanitizer/memory-eager.rs b/tests/ui/sanitizer/memory-eager.rs index 9498336abb7d0..f774e70a9fe3e 100644 --- a/tests/ui/sanitizer/memory-eager.rs +++ b/tests/ui/sanitizer/memory-eager.rs @@ -1,12 +1,14 @@ //@ needs-sanitizer-support //@ needs-sanitizer-memory // -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize // //@ revisions: unoptimized optimized // -//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O -//@ [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins +//@ [optimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [optimized]compile-flags: -Zsanitizer-memory-track-origins -O +//@ [unoptimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [unoptimized]compile-flags: -Zsanitizer-memory-track-origins // //@ run-fail //@ error-pattern: MemorySanitizer: use-of-uninitialized-value diff --git a/tests/ui/sanitizer/memory-passing.rs b/tests/ui/sanitizer/memory-passing.rs index 6ac41b178fe7f..007cc8faea340 100644 --- a/tests/ui/sanitizer/memory-passing.rs +++ b/tests/ui/sanitizer/memory-passing.rs @@ -1,12 +1,14 @@ //@ needs-sanitizer-support //@ needs-sanitizer-memory // -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize // //@ revisions: unoptimized optimized // -//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O -//@ [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins +//@ [optimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [optimized]compile-flags: -Zsanitizer-memory-track-origins -O +//@ [unoptimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [unoptimized]compile-flags: -Zsanitizer-memory-track-origins // //@ run-pass // diff --git a/tests/ui/sanitizer/memory.rs b/tests/ui/sanitizer/memory.rs index 1566637acd222..7c2150f1ea77e 100644 --- a/tests/ui/sanitizer/memory.rs +++ b/tests/ui/sanitizer/memory.rs @@ -1,12 +1,14 @@ //@ needs-sanitizer-support //@ needs-sanitizer-memory // -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize // //@ revisions: unoptimized optimized // -//@ [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O -//@ [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins +//@ [optimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [optimized]compile-flags: -Zsanitizer-memory-track-origins -O +//@ [unoptimized]compile-flags: -Zunstable-options -Csanitize=memory +//@ [unoptimized]compile-flags: -Zsanitizer-memory-track-origins // //@ run-fail //@ error-pattern: MemorySanitizer: use-of-uninitialized-value diff --git a/tests/ui/sanitizer/new-llvm-pass-manager-thin-lto.rs b/tests/ui/sanitizer/new-llvm-pass-manager-thin-lto.rs index b66568474277e..b288ed3a17e6c 100644 --- a/tests/ui/sanitizer/new-llvm-pass-manager-thin-lto.rs +++ b/tests/ui/sanitizer/new-llvm-pass-manager-thin-lto.rs @@ -6,11 +6,11 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize // //@ no-prefer-dynamic //@ revisions: opt0 opt1 -//@ compile-flags: -Zsanitizer=address -Clto=thin +//@ compile-flags: -Zunstable-options -Csanitize=address -Clto=thin //@[opt0]compile-flags: -Copt-level=0 //@[opt1]compile-flags: -Copt-level=1 //@ run-fail-or-crash diff --git a/tests/ui/sanitizer/split-lto-unit-requires-lto.rs b/tests/ui/sanitizer/split-lto-unit-requires-lto.rs index 1d08ca7423fd6..caa9536c667fd 100644 --- a/tests/ui/sanitizer/split-lto-unit-requires-lto.rs +++ b/tests/ui/sanitizer/split-lto-unit-requires-lto.rs @@ -1,7 +1,7 @@ // Verifies that `-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsplit-lto-unit +//@ compile-flags: -Ctarget-feature=-crt-static -Zsplit-lto-unit #![feature(no_core)] #![no_core] diff --git a/tests/ui/sanitizer/stable-and-unstable-supported-can-be-used-with-unstable-options.rs b/tests/ui/sanitizer/stable-and-unstable-supported-can-be-used-with-unstable-options.rs new file mode 100644 index 0000000000000..2678d8904011a --- /dev/null +++ b/tests/ui/sanitizer/stable-and-unstable-supported-can-be-used-with-unstable-options.rs @@ -0,0 +1,11 @@ +// Verifies that stable and unstable supported sanitizers can be used with `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ needs-sanitizer-support +//@ build-pass +//@ compile-flags: -Zunstable-options -Clto -Csanitize=address,cfi --target x86_64-unknown-linux-gnu + +#![crate_type = "rlib"] +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.rs b/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.rs new file mode 100644 index 0000000000000..da15546055ad9 --- /dev/null +++ b/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.rs @@ -0,0 +1,9 @@ +// Verifies that stable and unstable supported sanitizers cannot be used without +// `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ needs-sanitizer-support +//@ compile-flags: -Clto -Csanitize=address,cfi --target x86_64-unknown-linux-gnu +//@ error-pattern: error: cfi sanitizer is not supported for this target + +fn main() { } diff --git a/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.stderr b/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.stderr new file mode 100644 index 0000000000000..b423f8e9eec72 --- /dev/null +++ b/tests/ui/sanitizer/stable-and-unstable-supported-cannot-be-used-without-unstable-options.stderr @@ -0,0 +1,4 @@ +error: cfi sanitizer is not supported for this target + +error: aborting due to 1 previous error + diff --git a/tests/ui/sanitizer/stable-supported-can-be-used-with-unstable-options.rs b/tests/ui/sanitizer/stable-supported-can-be-used-with-unstable-options.rs new file mode 100644 index 0000000000000..1928c26dcbd5d --- /dev/null +++ b/tests/ui/sanitizer/stable-supported-can-be-used-with-unstable-options.rs @@ -0,0 +1,8 @@ +// Verifies that stable supported sanitizers can be used with `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ needs-sanitizer-support +//@ build-pass +//@ compile-flags: -Zunstable-options -Csanitize=address --target x86_64-unknown-linux-gnu + +fn main() { } diff --git a/tests/ui/sanitizer/stable-supported-can-be-used-without-unstable-options.rs b/tests/ui/sanitizer/stable-supported-can-be-used-without-unstable-options.rs new file mode 100644 index 0000000000000..0a3d79365b5fe --- /dev/null +++ b/tests/ui/sanitizer/stable-supported-can-be-used-without-unstable-options.rs @@ -0,0 +1,8 @@ +// Verifies that stable supported sanitizers can be used without `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ needs-sanitizer-support +//@ build-pass +//@ compile-flags: -Csanitize=address --target x86_64-unknown-linux-gnu + +fn main() { } diff --git a/tests/ui/sanitizer/thread.rs b/tests/ui/sanitizer/thread.rs index 8f72b1b41a84c..ded265cbbee4e 100644 --- a/tests/ui/sanitizer/thread.rs +++ b/tests/ui/sanitizer/thread.rs @@ -13,7 +13,7 @@ //@ needs-sanitizer-support //@ needs-sanitizer-thread // -//@ compile-flags: -Z sanitizer=thread -O -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=thread -O // //@ run-fail-or-crash //@ error-pattern: WARNING: ThreadSanitizer: data race diff --git a/tests/ui/sanitizer/unstable-supported-can-be-used-with-unstable-options.rs b/tests/ui/sanitizer/unstable-supported-can-be-used-with-unstable-options.rs new file mode 100644 index 0000000000000..b09197bae05c5 --- /dev/null +++ b/tests/ui/sanitizer/unstable-supported-can-be-used-with-unstable-options.rs @@ -0,0 +1,10 @@ +// Verifies that unstable supported sanitizers can be used with `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kernel-address --target x86_64-unknown-none +//@ build-pass + +#![crate_type = "rlib"] +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.rs b/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.rs new file mode 100644 index 0000000000000..f7a806cd27f7f --- /dev/null +++ b/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.rs @@ -0,0 +1,10 @@ +// Verifies that unstable supported sanitizers cannot be used without `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Csanitize=kernel-address --target x86_64-unknown-none + +#![feature(no_core)] +#![no_core] +#![no_main] + +//~? ERROR kernel-address sanitizer is not supported for this target diff --git a/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.stderr b/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.stderr new file mode 100644 index 0000000000000..9c04afbb32a5f --- /dev/null +++ b/tests/ui/sanitizer/unstable-supported-cannot-be-used-without-unstable-options.stderr @@ -0,0 +1,4 @@ +error: kernel-address sanitizer is not supported for this target + +error: aborting due to 1 previous error + diff --git a/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.rs b/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.rs new file mode 100644 index 0000000000000..31666696bc044 --- /dev/null +++ b/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.rs @@ -0,0 +1,10 @@ +// Verifies that unsupported sanitizers cannot be used with `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kernel-address --target x86_64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_main] + +//~? ERROR kernel-address sanitizer is not supported for this target diff --git a/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.stderr b/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.stderr new file mode 100644 index 0000000000000..9c04afbb32a5f --- /dev/null +++ b/tests/ui/sanitizer/unsupported-cannot-be-used-with-unstable-options.stderr @@ -0,0 +1,4 @@ +error: kernel-address sanitizer is not supported for this target + +error: aborting due to 1 previous error + diff --git a/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.rs b/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.rs new file mode 100644 index 0000000000000..b8632f50b9a06 --- /dev/null +++ b/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.rs @@ -0,0 +1,10 @@ +// Verifies that unsupported sanitizers cannot be used without `-Zunstable-options`. +// +//@ needs-llvm-components: x86 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Csanitize=kernel-address --target x86_64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_main] + +//~? ERROR kernel-address sanitizer is not supported for this target diff --git a/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.stderr b/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.stderr new file mode 100644 index 0000000000000..9c04afbb32a5f --- /dev/null +++ b/tests/ui/sanitizer/unsupported-cannot-be-used-without-unstable-options.stderr @@ -0,0 +1,4 @@ +error: kernel-address sanitizer is not supported for this target + +error: aborting due to 1 previous error + diff --git a/tests/ui/sanitizer/unsupported-target.rs b/tests/ui/sanitizer/unsupported-target.rs deleted file mode 100644 index 14925548e9271..0000000000000 --- a/tests/ui/sanitizer/unsupported-target.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ compile-flags: -Z sanitizer=leak --target i686-unknown-linux-gnu -//@ needs-llvm-components: x86 - -#![feature(no_core)] -#![no_core] -#![no_main] - -//~? ERROR leak sanitizer is not supported for this target diff --git a/tests/ui/sanitizer/unsupported-target.stderr b/tests/ui/sanitizer/unsupported-target.stderr deleted file mode 100644 index bebbf3884ae67..0000000000000 --- a/tests/ui/sanitizer/unsupported-target.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: leak sanitizer is not supported for this target - -error: aborting due to 1 previous error - diff --git a/tests/ui/sanitizer/use-after-scope.rs b/tests/ui/sanitizer/use-after-scope.rs index 1c477d0be14b8..21c48deb80a7e 100644 --- a/tests/ui/sanitizer/use-after-scope.rs +++ b/tests/ui/sanitizer/use-after-scope.rs @@ -2,8 +2,8 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer -//@ run-fail-or-crash +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address +//@ run-fail //@ error-pattern: ERROR: AddressSanitizer: stack-use-after-scope static mut P: *mut usize = std::ptr::null_mut(); diff --git a/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs b/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs index f97005a14502d..b777a014bfdd8 100644 --- a/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs +++ b/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs @@ -1,6 +1,6 @@ //@ no-prefer-dynamic //@ needs-sanitizer-kcfi -//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Cpanic=abort -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-normalize-integers #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs b/tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs index 029744d2a1fe4..dbd0cd02e268e 100644 --- a/tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs +++ b/tests/ui/target_modifiers/auxiliary/safestack-and-kcfi.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-kcfi //@ needs-sanitizer-safestack -//@ compile-flags: -C panic=abort -Zsanitizer=safestack,kcfi +//@ compile-flags: -Cpanic=abort -Zunstable-options -Csanitize=safestack,kcfi #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs index cb9f701349ae6..e16c4e0432c93 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs @@ -5,13 +5,13 @@ //@ compile-flags: -Cpanic=abort //@ revisions: ok wrong_flag wrong_sanitizer -//@[ok] compile-flags: -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -//@[wrong_flag] compile-flags: -Zsanitizer=kcfi +//@[ok] compile-flags: -Zunstable-options -Csanitize=kcfi -Zsanitizer-cfi-normalize-integers +//@[wrong_flag] compile-flags: -Zunstable-options -Csanitize=kcfi //@[ok] check-pass #![feature(no_core)] //[wrong_flag]~^ ERROR mixing `-Zsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` -//[wrong_sanitizer]~^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +//[wrong_sanitizer]~^^ ERROR mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr index 5b949c87350b9..770cd5e9f6821 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr @@ -1,13 +1,13 @@ -error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +error: mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` --> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kcfi` in dependency `kcfi_normalize_ints` - = help: set `-Zsanitizer=kcfi` in this crate or unset `-Zsanitizer` in `kcfi_normalize_ints` - = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error + = help: the `-Csanitize` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Csanitize` in this crate is incompatible with `-Csanitize=kcfi` in dependency `kcfi_normalize_ints` + = help: set `-Csanitize=kcfi` in this crate or unset `-Csanitize` in `kcfi_normalize_ints` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitize` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs b/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs index abda7be9e4057..678ce6850b41c 100644 --- a/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs +++ b/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs @@ -6,10 +6,10 @@ //@[wrong_leak_san] needs-sanitizer-leak //@ aux-build:no-sanitizers.rs -//@ compile-flags: -Cpanic=abort -C target-feature=-crt-static +//@ compile-flags: -Cpanic=abort -Ctarget-feature=-crt-static -//@[wrong_address_san] compile-flags: -Zsanitizer=address -//@[wrong_leak_san] compile-flags: -Zsanitizer=leak +//@[wrong_address_san] compile-flags: -Zunstable-options -Csanitize=address +//@[wrong_leak_san] compile-flags: -Zunstable-options -Csanitize=leak //@ check-pass #![feature(no_core)] diff --git a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr index 440a91c7707f8..eac31e579bd3a 100644 --- a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr +++ b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr @@ -1,13 +1,13 @@ -error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +error: mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` --> $DIR/sanitizers-safestack-and-kcfi.rs:16:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi` - = help: set `-Zsanitizer=safestack,kcfi` in this crate or unset `-Zsanitizer` in `safestack_and_kcfi` - = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error + = help: the `-Csanitize` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Csanitize` in this crate is incompatible with `-Csanitize=safestack,kcfi` in dependency `safestack_and_kcfi` + = help: set `-Csanitize=safestack,kcfi` in this crate or unset `-Csanitize` in `safestack_and_kcfi` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitize` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_kcfi.stderr b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_kcfi.stderr index 6cdd7facc3781..8cdf6a81242f0 100644 --- a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_kcfi.stderr +++ b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_kcfi.stderr @@ -1,13 +1,13 @@ -error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +error: mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` --> $DIR/sanitizers-safestack-and-kcfi.rs:16:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zsanitizer=safestack` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi` - = help: set `-Zsanitizer=safestack,kcfi` in this crate or `-Zsanitizer=safestack` in `safestack_and_kcfi` - = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error + = help: the `-Csanitize` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Csanitize=safestack` in this crate is incompatible with `-Csanitize=safestack,kcfi` in dependency `safestack_and_kcfi` + = help: set `-Csanitize=safestack,kcfi` in this crate or `-Csanitize=safestack` in `safestack_and_kcfi` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitize` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_safestack.stderr b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_safestack.stderr index ecfbcace39fe5..e536d5aed5a55 100644 --- a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_safestack.stderr +++ b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_safestack.stderr @@ -1,13 +1,13 @@ -error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +error: mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` --> $DIR/sanitizers-safestack-and-kcfi.rs:16:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zsanitizer=kcfi` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi` - = help: set `-Zsanitizer=safestack,kcfi` in this crate or `-Zsanitizer=kcfi` in `safestack_and_kcfi` - = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error + = help: the `-Csanitize` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Csanitize=kcfi` in this crate is incompatible with `-Csanitize=safestack,kcfi` in dependency `safestack_and_kcfi` + = help: set `-Csanitize=safestack,kcfi` in this crate or `-Csanitize=kcfi` in `safestack_and_kcfi` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitize` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs index 6c3ceb7e91008..b1d7e20e43d79 100644 --- a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs +++ b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs @@ -5,18 +5,18 @@ //@ compile-flags: -Cpanic=abort //@ revisions: good good_reverted missed_safestack missed_kcfi missed_both -//@[good] compile-flags: -Zsanitizer=safestack,kcfi -//@[good_reverted] compile-flags: -Zsanitizer=kcfi,safestack -//@[missed_safestack] compile-flags: -Zsanitizer=kcfi -//@[missed_kcfi] compile-flags: -Zsanitizer=safestack +//@[good] compile-flags: -Zunstable-options -Csanitize=safestack,kcfi +//@[good_reverted] compile-flags: -Zunstable-options -Csanitize=kcfi,safestack +//@[missed_safestack] compile-flags: -Zunstable-options -Csanitize=kcfi +//@[missed_kcfi] compile-flags: -Zunstable-options -Csanitize=safestack // [missed_both] no additional compile-flags: //@[good] check-pass //@[good_reverted] check-pass #![feature(no_core)] -//[missed_safestack]~^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` -//[missed_kcfi]~^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` -//[missed_both]~^^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +//[missed_safestack]~^ ERROR mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +//[missed_kcfi]~^^ ERROR mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` +//[missed_both]~^^^ ERROR mixing `-Csanitize` will cause an ABI mismatch in crate `sanitizers_safestack_and_kcfi` #![crate_type = "rlib"] #![no_core]