From 17eff5397b7f752ca08a65c7cfe7ec93981288fa Mon Sep 17 00:00:00 2001 From: Ramon de C Valle Date: Sat, 6 Apr 2024 14:43:39 -0700 Subject: [PATCH] sanitizers: Stabilize core sanitizers Stabilize AddressSanitizer, LeakSanitizer, MemorySanitizer, ThreadSanitizer for the Tier 1 targets that support them. --- .../src/spec/targets/aarch64_unknown_linux_gnu.rs | 11 +++++------ .../src/spec/targets/i686_pc_windows_msvc.rs | 2 +- .../src/spec/targets/i686_unknown_linux_gnu.rs | 2 +- .../src/spec/targets/x86_64_apple_darwin.rs | 7 ++----- .../src/spec/targets/x86_64_pc_windows_msvc.rs | 2 +- .../src/spec/targets/x86_64_unknown_linux_gnu.rs | 11 +++++------ 6 files changed, 15 insertions(+), 20 deletions(-) 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;