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 99b9126ca91a..9fae8fc11e82 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 @@ -18,15 +18,14 @@ pub fn target() -> Target { max_atomic_width: Some(128), stack_probes: StackProbeType::Inline, supported_sanitizers: SanitizerSupport { - stable: SanitizerSet::empty(), - unstable: SanitizerSet::ADDRESS - | SanitizerSet::CFI - | SanitizerSet::HWADDRESS - | SanitizerSet::KCFI + stable: SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY - | SanitizerSet::MEMTAG | SanitizerSet::THREAD, + unstable: SanitizerSet::CFI + | SanitizerSet::KCFI + | SanitizerSet::MEMTAG + | SanitizerSet::HWADDRESS, }, 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 eb7e55e5908f..2a33f0ca73d4 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 @@ -5,7 +5,7 @@ pub fn target() -> Target { base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = - SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS }; + SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() }; 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 f44a67d42462..7fd975e11613 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 @@ -7,7 +7,7 @@ pub fn target() -> Target { base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); base.supported_sanitizers = - SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS }; + SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() }; 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 8d05d79cbc5c..96265f43025a 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 @@ -10,11 +10,8 @@ pub fn target() -> Target { base.frame_pointer = FramePointer::Always; base.add_pre_link_args(LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-m64"]); base.supported_sanitizers = SanitizerSupport { - stable: SanitizerSet::empty(), - unstable: SanitizerSet::ADDRESS - | SanitizerSet::CFI - | SanitizerSet::LEAK - | SanitizerSet::THREAD, + stable: SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD, + unstable: SanitizerSet::CFI, }; Target { 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 433dd791cd00..d342ae0f7162 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,7 +7,7 @@ pub fn target() -> Target { base.plt_by_default = false; base.max_atomic_width = Some(128); base.supported_sanitizers = - SanitizerSupport { stable: SanitizerSet::empty(), unstable: SanitizerSet::ADDRESS }; + SanitizerSupport { stable: SanitizerSet::ADDRESS, unstable: SanitizerSet::empty() }; 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 3d3703726ebc..fa88a6dfe6e0 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 @@ -11,15 +11,14 @@ pub fn target() -> Target { base.stack_probes = StackProbeType::Inline; base.static_position_independent_executables = true; base.supported_sanitizers = SanitizerSupport { - stable: SanitizerSet::empty(), - unstable: SanitizerSet::ADDRESS - | SanitizerSet::CFI - | SanitizerSet::DATAFLOW - | SanitizerSet::KCFI + stable: SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY - | SanitizerSet::SAFESTACK | SanitizerSet::THREAD, + unstable: SanitizerSet::CFI + | SanitizerSet::KCFI + | SanitizerSet::DATAFLOW + | SanitizerSet::SAFESTACK, }; base.supports_xray = true; 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 000000000000..e95e7c82f52d --- /dev/null +++ b/tests/ui/sanitizer/stable-supported-can-be-used-with-unstable-options.rs @@ -0,0 +1,11 @@ +// Verifies that stable supported sanitizers can be used with `-Zunstable-options`. +// +//@ needs-llvm-components: x86_64 +//@ needs-sanitizer-support +//@ needs-sanitizer-address +//@ build-pass +//@ compile-flags: -Zunstable-options -Csanitizer=address --target x86_64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_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 000000000000..e8efe334cf77 --- /dev/null +++ b/tests/ui/sanitizer/stable-supported-can-be-used-without-unstable-options.rs @@ -0,0 +1,11 @@ +// Verifies that stable supported sanitizers can be used without `-Zunstable-options`. +// +//@ needs-llvm-components: x86_64 +//@ needs-sanitizer-support +//@ needs-sanitizer-address +//@ build-pass +//@ compile-flags: -Csanitizer=address --target x86_64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_main]