Skip to content

Commit 3b81ea8

Browse files
authored
Rollup merge of #84126 - 12101111:musl-sanitizer, r=davidtwco
Enable sanitizers for x86_64-unknown-linux-musl Those 4 sanitizers get musl target support in LLVM 12 release.
2 parents 817b7e0 + 7cd0a4d commit 3b81ea8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, StackProbeType, Target};
1+
use crate::spec::{LinkerFlavor, SanitizerSet, StackProbeType, Target};
22

33
pub fn target() -> Target {
44
let mut base = super::linux_musl_base::opts();
@@ -7,6 +7,8 @@ pub fn target() -> Target {
77
base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m64".to_string());
88
base.stack_probes = StackProbeType::InlineOrCall { min_llvm_version_for_inline: (11, 0, 1) };
99
base.static_position_independent_executables = true;
10+
base.supported_sanitizers =
11+
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
1012

1113
Target {
1214
llvm_target: "x86_64-unknown-linux-musl".to_string(),

src/bootstrap/native.rs

+3
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,9 @@ fn supported_sanitizers(
814814
"x86_64-unknown-linux-gnu" => {
815815
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
816816
}
817+
"x86_64-unknown-linux-musl" => {
818+
common_libs("linux", "x86_64", &["asan", "lsan", "msan", "tsan"])
819+
}
817820
_ => Vec::new(),
818821
}
819822
}

0 commit comments

Comments
 (0)