Skip to content

Commit d779a59

Browse files
authored
Rollup merge of #107127 - uweigand:s390x-sanitizer, r=Mark-Simulacrum
Enable sanitizers for s390x-linux Include sanitizers supported by LLVM on s390x (asan, lsan, msan, tsan) in the target definition, as well as in the compiletest supported list. Build sanitizer runtime for the target. Enable sanitizers in the CI.
2 parents 17b9f2a + 492d928 commit d779a59

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

Diff for: compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{StackProbeType, Target};
2+
use crate::spec::{SanitizerSet, StackProbeType, Target};
33

44
pub fn target() -> Target {
55
let mut base = super::linux_gnu_base::opts();
@@ -13,6 +13,8 @@ pub fn target() -> Target {
1313
base.max_atomic_width = Some(64);
1414
base.min_global_align = Some(16);
1515
base.stack_probes = StackProbeType::Inline;
16+
base.supported_sanitizers =
17+
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
1618

1719
Target {
1820
llvm_target: "s390x-unknown-linux-gnu".into(),

Diff for: compiler/rustc_target/src/spec/s390x_unknown_linux_musl.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{StackProbeType, Target};
2+
use crate::spec::{SanitizerSet, StackProbeType, Target};
33

44
pub fn target() -> Target {
55
let mut base = super::linux_musl_base::opts();
@@ -14,6 +14,8 @@ pub fn target() -> Target {
1414
base.min_global_align = Some(16);
1515
base.static_position_independent_executables = true;
1616
base.stack_probes = StackProbeType::Inline;
17+
base.supported_sanitizers =
18+
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
1719

1820
Target {
1921
llvm_target: "s390x-unknown-linux-musl".into(),

Diff for: src/bootstrap/native.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,12 @@ fn supported_sanitizers(
11051105
"x86_64-unknown-linux-musl" => {
11061106
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
11071107
}
1108+
"s390x-unknown-linux-gnu" => {
1109+
common_libs("linux", "s390x", &["asan", "lsan", "msan", "tsan"])
1110+
}
1111+
"s390x-unknown-linux-musl" => {
1112+
common_libs("linux", "s390x", &["asan", "lsan", "msan", "tsan"])
1113+
}
11081114
_ => Vec::new(),
11091115
}
11101116
}

Diff for: src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ ENV \
2828

2929
ENV HOSTS=s390x-unknown-linux-gnu
3030

31-
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-profiler --disable-docs
31+
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-sanitizers --enable-profiler --disable-docs
3232
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

Diff for: src/tools/compiletest/src/util.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub const ASAN_SUPPORTED_TARGETS: &[&str] = &[
2323
"x86_64-linux-android",
2424
"x86_64-unknown-freebsd",
2525
"x86_64-unknown-linux-gnu",
26+
"s390x-unknown-linux-gnu",
2627
];
2728

2829
// FIXME(rcvalle): More targets are likely supported.
@@ -50,17 +51,23 @@ pub const LSAN_SUPPORTED_TARGETS: &[&str] = &[
5051
"aarch64-unknown-linux-gnu",
5152
"x86_64-apple-darwin",
5253
"x86_64-unknown-linux-gnu",
54+
"s390x-unknown-linux-gnu",
5355
];
5456

55-
pub const MSAN_SUPPORTED_TARGETS: &[&str] =
56-
&["aarch64-unknown-linux-gnu", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu"];
57+
pub const MSAN_SUPPORTED_TARGETS: &[&str] = &[
58+
"aarch64-unknown-linux-gnu",
59+
"x86_64-unknown-freebsd",
60+
"x86_64-unknown-linux-gnu",
61+
"s390x-unknown-linux-gnu",
62+
];
5763

5864
pub const TSAN_SUPPORTED_TARGETS: &[&str] = &[
5965
"aarch64-apple-darwin",
6066
"aarch64-unknown-linux-gnu",
6167
"x86_64-apple-darwin",
6268
"x86_64-unknown-freebsd",
6369
"x86_64-unknown-linux-gnu",
70+
"s390x-unknown-linux-gnu",
6471
];
6572

6673
pub const HWASAN_SUPPORTED_TARGETS: &[&str] =

0 commit comments

Comments
 (0)