diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index c3c1caf086f09..95f198388f9eb 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -16,7 +16,7 @@ use rustc_session::{Session, config}; use rustc_target::callconv::{ ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, PassMode, }; -use rustc_target::spec::{Arch, SanitizerSet}; +use rustc_target::spec::Arch; use smallvec::SmallVec; use crate::attributes::{self, llfn_attrs_from_instance}; @@ -96,7 +96,7 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&' } } } - } else if cx.tcx.sess.sanitizers().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 a25ce9e5a90ac..de866e1c26fdd 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -260,7 +260,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.sanitizers().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 d35c3b6bb189e..8fc2319ad6f57 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2494,7 +2494,7 @@ fn add_order_independent_options( && crate_type == CrateType::Executable && !matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _)) { - let prefix = if sess.sanitizers().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_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 6752ddbc5706e..aefa827dea463 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_session/messages.ftl b/compiler/rustc_session/messages.ftl index a4166951e350a..d0195e3cbf22c 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/options.rs b/compiler/rustc_session/src/options.rs index d9792142a884d..f19aebc5a0d40 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -136,10 +136,12 @@ impl TargetModifier { pub fn consistent(&self, sess: &Session, 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( sess, self, other, @@ -147,7 +149,6 @@ impl TargetModifier { } _ => {} }, - _ => {} }; match other { Some(other) => self.extend().tech_value == other.extend().tech_value, @@ -1263,26 +1264,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, - "realtime" => SanitizerSet::REALTIME, - _ => 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 } @@ -2186,6 +2175,9 @@ 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)"), + #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] + sanitize: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], + "use one or multiple sanitizers"), save_temps: bool = (false, parse_bool, [UNTRACKED], "save all temporary output files during compilation (default: no)"), soft_float: bool = (false, parse_bool, [TRACKED], @@ -2604,9 +2596,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)"), - #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] - 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], diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index acc65fc11a2a2..bfb3a9fd336d6 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -307,6 +307,10 @@ impl Session { &self.opts.unstable_opts.coverage_options } + pub fn is_sanitizer_address_enabled(&self) -> bool { + self.sanitizers().contains(SanitizerSet::ADDRESS) + } + pub fn is_sanitizer_cfi_enabled(&self) -> bool { self.sanitizers().contains(SanitizerSet::CFI) } @@ -327,6 +331,10 @@ impl Session { self.opts.unstable_opts.sanitizer_cfi_normalize_integers == Some(true) } + pub fn is_sanitizer_hwaddress_enabled(&self) -> bool { + self.sanitizers().contains(SanitizerSet::HWADDRESS) + } + pub fn is_sanitizer_kcfi_arity_enabled(&self) -> bool { self.opts.unstable_opts.sanitizer_kcfi_arity == Some(true) } @@ -335,6 +343,26 @@ impl Session { self.sanitizers().contains(SanitizerSet::KCFI) } + pub fn is_sanitizer_kernel_address_enabled(&self) -> bool { + self.sanitizers().contains(SanitizerSet::KERNELADDRESS) + } + + pub fn is_sanitizer_memory_enabled(&self) -> bool { + self.sanitizers().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.sanitizers().contains(SanitizerSet::THREAD) + } + pub fn is_split_lto_unit_enabled(&self) -> bool { self.opts.unstable_opts.split_lto_unit == Some(true) } @@ -512,7 +540,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.sanitizers().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 { @@ -655,7 +686,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 } } @@ -901,7 +932,7 @@ impl Session { } pub fn sanitizers(&self) -> SanitizerSet { - return self.opts.unstable_opts.sanitizer | self.target.options.default_sanitizers; + return self.opts.cg.sanitize | self.target.options.default_sanitizers; } } @@ -1169,14 +1200,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.sanitizers() - 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 == Arch::AArch64 { unsupported_sanitizers -= SanitizerSet::SHADOWCALLSTACK; } + match unsupported_sanitizers.into_iter().count() { 0 => {} 1 => { @@ -1191,7 +1227,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(), @@ -1199,10 +1235,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.sanitizers().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 a972299deeac4..70f2e71753417 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -401,6 +401,7 @@ impl ToJson for Target { target_option_val!(supported_split_debuginfo); target_option_val!(supported_sanitizers); target_option_val!(default_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 c76e345bb7b64..4f31e7fbcb8f5 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1233,6 +1233,38 @@ 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, + "realtime" => SanitizerSet::REALTIME, + "safestack" => SanitizerSet::SAFESTACK, + "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, + "thread" => SanitizerSet::THREAD, + "hwaddress" => SanitizerSet::HWADDRESS, + _ => return Err(format!("Unknown sanitizer {}", name)), + }; + } + return Ok(sanitizer_set); + } + + pub 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() @@ -1269,11 +1301,11 @@ impl FromStr for SanitizerSet { "leak" => SanitizerSet::LEAK, "memory" => SanitizerSet::MEMORY, "memtag" => SanitizerSet::MEMTAG, + "realtime" => SanitizerSet::REALTIME, "safestack" => SanitizerSet::SAFESTACK, "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, "thread" => SanitizerSet::THREAD, "hwaddress" => SanitizerSet::HWADDRESS, - "realtime" => SanitizerSet::REALTIME, s => return Err(format!("unknown sanitizer {s}")), }) } @@ -2563,6 +2595,13 @@ pub struct TargetOptions { /// distributed with the target, the sanitizer should still appear in this list for the target. pub default_sanitizers: SanitizerSet, + /// The stable sanitizers supported by this target + /// + /// Note that the support here is at a codegen level. If the machine code with sanitizer + /// enabled can generated on this target, but the necessary supporting libraries are not + /// distributed with the target, the sanitizer should still appear in this list for the 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, @@ -2817,6 +2856,7 @@ impl Default for TargetOptions { supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), supported_sanitizers: SanitizerSet::empty(), default_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 da3d7c7d99db3..8d506acfdee73 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -22,8 +22,9 @@ pub(crate) fn target() -> Target { // FIXME: The leak sanitizer currently fails the tests, see #88132. supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI - | SanitizerSet::THREAD - | SanitizerSet::REALTIME, + | SanitizerSet::REALTIME + | 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 f7e1cbfac2635..82ff7633e25ca 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,13 +25,14 @@ 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::REALTIME, + | SanitizerSet::REALTIME + | 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 8f2746c461661..a434914fcc3e0 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 932f6034433e5..ef6af5d3f8af8 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 @@ -20,6 +20,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 8d0febc362d40..08280b6170de4 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 @@ -21,8 +21,9 @@ pub(crate) fn target() -> Target { supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK - | SanitizerSet::THREAD - | SanitizerSet::REALTIME, + | SanitizerSet::REALTIME + | 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 20b6e0701bffa..f417d66a99255 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 defa9f146d798..cacf1c2d55383 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,13 +12,14 @@ 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 - | SanitizerSet::REALTIME; + | SanitizerSet::REALTIME + | SanitizerSet::THREAD; + base.stable_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK; base.supports_xray = true; Target { diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index 832b5a69d47c4..7c32d37cb8b34 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 f0f991ed0c909..e8953ad7a1a17 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -647,6 +647,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 02b93593cbbd4..50f1965dc1b00 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -1009,7 +1009,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 208e96166021e..4009418773d86 100644 --- a/src/tools/compiletest/src/directives/needs.rs +++ b/src/tools/compiletest/src/directives/needs.rs @@ -42,8 +42,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 { @@ -321,7 +321,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, @@ -341,14 +341,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 9dbbee47f75d7..3ff170d67543d 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-minicore +//@ 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 bde2bd095b779..8cbb5fd2fb5f4 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-minicore //@ 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..f9ca5ded15d8d 100644 --- a/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs +++ b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs @@ -19,9 +19,11 @@ //@ 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 +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize +//@[ASAN] compile-flags: -Zunstable-options -Csanitize=address +//@[ASAN-FAT-LTO] compile-flags: -Clto=fat -Cprefer-dynamic=false +//@[ASAN-FAT-LTO] compile-flags: -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 a5ec3a9ab7183..5262f179fc0c9 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 4ce9c57070a72..d6b103e0f1f1d 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 da0c976d8a53d..1af69853f086a 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-minicore -//@ 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 24c5d1be1d60b..51b6713120c29 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 a8e3b034eae75..8be1527722538 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 53b1a3f2d74a5..28e95fe59741b 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 82747351e0281..dd76805bf164b 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 ee4928053cf9e..ed8cdee8b2dfe 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 @@ -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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ 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 9b861c08ac955..9b24626011188 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 @@ -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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers +//@ 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 c2410aa9f4d82..83b8a0377e5d8 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 @@ -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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ 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 fbad335286cb1..d49d14104de5b 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 @@ -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: -Cno-prepopulate-passes -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 #![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 6c7a8194ec4eb..ed72933b24b89 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 @@ -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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ 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 e22a210f3dfb8..0696104e449cd 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ 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 3312f12f68850..8ba7304e100e1 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 @@ -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: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ 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/fn-ptr-reify-shim.rs b/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs index 676b2af8c8f1d..bdbba3f189600 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.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/kcfi/naked-function.rs b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs index 830689780dce5..fb7e0a375cf16 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 72f9c12fae0e2..d8a3e6a6fab93 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-minicore -//@ 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 c5df311efae09..7fc9fcc19af3b 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-minicore -//@ 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 ac7c49322c6d8..66740e59d65c1 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 824327ad06d36..fd4dcb3db864d 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 //@ ignore-backends: gcc 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..6aad7201e098b 100644 --- a/tests/ui/lto/issue-100772.rs +++ b/tests/ui/lto/issue-100772.rs @@ -1,6 +1,6 @@ //@ build-pass //@ 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 -Zunstable-options -Csanitize=cfi //@ 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 b4e7d8f254ca9..8b74814779c2f 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 2d934357adfe0..77cb5224489c0 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-minicore //@ 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 //@ ignore-backends: gcc #![crate_type = "rlib"] diff --git a/tests/ui/sanitizer/cfg.rs b/tests/ui/sanitizer/cfg.rs index 70914dcf93617..5be494c9e5427 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-minicore //@ 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 //@ ignore-backends: gcc #![feature(cfg_sanitize, no_core)] 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/fn-trait-objects.rs b/tests/ui/sanitizer/cfi/fn-trait-objects.rs index 977d4124fff0c..2c451493e4c8f 100644 --- a/tests/ui/sanitizer/cfi/fn-trait-objects.rs +++ b/tests/ui/sanitizer/cfi/fn-trait-objects.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ only-linux //@ ignore-backends: gcc -//@ compile-flags: -Ctarget-feature=-crt-static -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Copt-level=0 -Zsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer --test +//@ compile-flags: -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=cfi --test //@ run-pass #![feature(fn_traits)] 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 71cae90743078..11aac97e147c3 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs @@ -1,11 +1,11 @@ -// 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 //@ ignore-backends: gcc #![feature(no_core)] @@ -13,4 +13,4 @@ #![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 e3e03fee08c30..52b1a29e9e85f 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 //@ ignore-backends: gcc use std::mem::size_of; diff --git a/tests/ui/sanitizer/hwaddress.rs b/tests/ui/sanitizer/hwaddress.rs index 8666e7de44924..4736aed116a7d 100644 --- a/tests/ui/sanitizer/hwaddress.rs +++ b/tests/ui/sanitizer/hwaddress.rs @@ -1,7 +1,7 @@ //@ needs-sanitizer-support //@ needs-sanitizer-hwaddress // -//@ compile-flags: -Z sanitizer=hwaddress -O -g -C target-feature=+tagged-globals -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Z sanitizer=hwaddress -O -g -C target-feature=+tagged-globals // //@ 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-c-variadic.rs b/tests/ui/sanitizer/kcfi-c-variadic.rs index 45d00a4524ebf..b6d727ade7d45 100644 --- a/tests/ui/sanitizer/kcfi-c-variadic.rs +++ b/tests/ui/sanitizer/kcfi-c-variadic.rs @@ -1,6 +1,6 @@ //@ needs-sanitizer-kcfi //@ no-prefer-dynamic -//@ compile-flags: -Zsanitizer=kcfi -Cpanic=abort -Cunsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cpanic=abort -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi //@ ignore-backends: gcc //@ run-pass 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/kcfi/fn-trait-objects.rs b/tests/ui/sanitizer/kcfi/fn-trait-objects.rs index 3f6b78545a0a1..fd2c84be471f4 100644 --- a/tests/ui/sanitizer/kcfi/fn-trait-objects.rs +++ b/tests/ui/sanitizer/kcfi/fn-trait-objects.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-kcfi //@ only-linux //@ ignore-backends: gcc -//@ compile-flags: -Ctarget-feature=-crt-static -Zpanic_abort_tests -Cpanic=abort -Cprefer-dynamic=off -Copt-level=0 -Zsanitizer=kcfi -Cunsafe-allow-abi-mismatch=sanitizer --test +//@ compile-flags: -Cpanic=abort -Cprefer-dynamic=off -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=kcfi -Zpanic_abort_tests --test //@ run-pass #![feature(fn_traits)] 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 59ad6eec0e329..57f54f8fa5e68 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 764d8b4432bf2..690625aa55d82 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 deeee694a1cf9..9e7598ddfa7ea 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 7ed21dce9f3e9..22d01f95cd8ed 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 0776c769e0796..0000000000000 --- a/tests/ui/sanitizer/unsupported-target.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ compile-flags: -Z sanitizer=leak --target i686-unknown-linux-gnu -//@ needs-llvm-components: x86 -//@ ignore-backends: gcc - -#![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 523b35869074c..401528f2e803d 100644 --- a/tests/ui/sanitizer/use-after-scope.rs +++ b/tests/ui/sanitizer/use-after-scope.rs @@ -2,7 +2,7 @@ //@ needs-sanitizer-address //@ ignore-cross-compile // -//@ compile-flags: -Zsanitizer=address -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitize -Zunstable-options -Csanitize=address //@ run-fail-or-crash //@ error-pattern: ERROR: AddressSanitizer: stack-use-after-scope //@ ignore-backends: gcc 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]