Skip to content

Commit 67c65ce

Browse files
committed
sanitizers: Stabilize AddressSanitizer and LeakSanitizer
Stabilize AddressSanitizer and LeakSanitizer for the Tier 1 targets that support them.
1 parent 9ed972b commit 67c65ce

12 files changed

+57
-10
lines changed

compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ pub(crate) fn target() -> Target {
2222
// FIXME: The leak sanitizer currently fails the tests, see #88132.
2323
supported_sanitizers: SanitizerSet::ADDRESS
2424
| SanitizerSet::CFI
25-
| SanitizerSet::THREAD
26-
| SanitizerSet::REALTIME,
25+
| SanitizerSet::REALTIME
26+
| SanitizerSet::THREAD,
27+
stable_sanitizers: SanitizerSet::ADDRESS,
2728
supports_xray: true,
2829
..opts
2930
},

compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ pub(crate) fn target() -> Target {
2525
stack_probes: StackProbeType::Inline,
2626
supported_sanitizers: SanitizerSet::ADDRESS
2727
| SanitizerSet::CFI
28+
| SanitizerSet::HWADDRESS
2829
| SanitizerSet::KCFI
2930
| SanitizerSet::LEAK
3031
| SanitizerSet::MEMORY
3132
| SanitizerSet::MEMTAG
32-
| SanitizerSet::THREAD
33-
| SanitizerSet::HWADDRESS
34-
| SanitizerSet::REALTIME,
33+
| SanitizerSet::REALTIME
34+
| SanitizerSet::THREAD,
35+
stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK,
3536
supports_xray: true,
3637
..base::linux_gnu::opts()
3738
},

compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub(crate) fn target() -> Target {
66
base.cpu = "pentium4".into();
77
base.max_atomic_width = Some(64);
88
base.supported_sanitizers = SanitizerSet::ADDRESS;
9+
base.stable_sanitizers = SanitizerSet::ADDRESS;
910

1011
base.add_pre_link_args(
1112
LinkerFlavor::Msvc(Lld::No),

compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
2020
base.cpu = "pentium4".into();
2121
base.max_atomic_width = Some(64);
2222
base.supported_sanitizers = SanitizerSet::ADDRESS;
23+
base.stable_sanitizers = SanitizerSet::ADDRESS;
2324
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
2425
base.stack_probes = StackProbeType::Inline;
2526

compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ pub(crate) fn target() -> Target {
2121
supported_sanitizers: SanitizerSet::ADDRESS
2222
| SanitizerSet::CFI
2323
| SanitizerSet::LEAK
24-
| SanitizerSet::THREAD
25-
| SanitizerSet::REALTIME,
24+
| SanitizerSet::REALTIME
25+
| SanitizerSet::THREAD,
26+
stable_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::LEAK,
2627
supports_xray: true,
2728
..opts
2829
},

compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub(crate) fn target() -> Target {
77
base.plt_by_default = false;
88
base.max_atomic_width = Some(128);
99
base.supported_sanitizers = SanitizerSet::ADDRESS;
10+
base.stable_sanitizers = SanitizerSet::ADDRESS;
1011

1112
Target {
1213
llvm_target: "x86_64-pc-windows-msvc".into(),

compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ pub(crate) fn target() -> Target {
1212
base.static_position_independent_executables = true;
1313
base.supported_sanitizers = SanitizerSet::ADDRESS
1414
| SanitizerSet::CFI
15-
| SanitizerSet::KCFI
1615
| SanitizerSet::DATAFLOW
16+
| SanitizerSet::KCFI
1717
| SanitizerSet::LEAK
1818
| SanitizerSet::MEMORY
1919
| SanitizerSet::SAFESTACK
20-
| SanitizerSet::THREAD
21-
| SanitizerSet::REALTIME;
20+
| SanitizerSet::REALTIME
21+
| SanitizerSet::THREAD;
22+
base.stable_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK;
2223
base.supports_xray = true;
2324

2425
Target {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Verifies that stable and unstable supported sanitizers can be used with `-Zunstable-options`.
2+
//
3+
//@ needs-llvm-components: x86
4+
//@ needs-sanitizer-support
5+
//@ build-pass
6+
//@ compile-flags: -Zunstable-options -Clto -Csanitize=address,cfi --target x86_64-unknown-linux-gnu
7+
8+
#![crate_type = "rlib"]
9+
#![feature(no_core)]
10+
#![no_core]
11+
#![no_main]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Verifies that stable and unstable supported sanitizers cannot be used without
2+
// `-Zunstable-options`.
3+
//
4+
//@ needs-llvm-components: x86
5+
//@ needs-sanitizer-support
6+
//@ compile-flags: -Clto -Csanitize=address,cfi --target x86_64-unknown-linux-gnu
7+
//@ error-pattern: error: cfi sanitizer is not supported for this target
8+
9+
fn main() { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: cfi sanitizer is not supported for this target
2+
3+
error: aborting due to 1 previous error
4+

0 commit comments

Comments
 (0)