Skip to content

Commit

Permalink
Support sanitizers on aarch64-unknown-linux-gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Jun 20, 2020
1 parent 033013c commit 2851c9f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/librustc_codegen_ssa/back/link.rs
Expand Up @@ -804,7 +804,10 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
linker.args(&["-Wl,-rpath", "-Xlinker", rpath]);
linker.link_dylib(Symbol::intern(&libname));
}
"x86_64-unknown-linux-gnu" | "x86_64-fuchsia" | "aarch64-fuchsia" => {
"aarch64-fuchsia"
| "aarch64-unknown-linux-gnu"
| "x86_64-fuchsia"
| "x86_64-unknown-linux-gnu" => {
let filename = format!("librustc{}_rt.{}.a", channel, name);
let path = default_tlib.join(&filename);
linker.link_whole_rlib(&path);
Expand Down
18 changes: 13 additions & 5 deletions src/librustc_session/session.rs
Expand Up @@ -1349,11 +1349,19 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
);
}

const ASAN_SUPPORTED_TARGETS: &[&str] =
&["aarch64-fuchsia", "x86_64-apple-darwin", "x86_64-fuchsia", "x86_64-unknown-linux-gnu"];
const LSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
const MSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu"];
const TSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
const ASAN_SUPPORTED_TARGETS: &[&str] = &[
"aarch64-fuchsia",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-fuchsia",
"x86_64-unknown-linux-gnu",
];
const LSAN_SUPPORTED_TARGETS: &[&str] =
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
const MSAN_SUPPORTED_TARGETS: &[&str] =
&["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"];
const TSAN_SUPPORTED_TARGETS: &[&str] =
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];

// Sanitizers can only be used on some tested platforms.
for s in sess.opts.debugging_opts.sanitizer {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/sanitize/unsupported-target.stderr
@@ -1,4 +1,4 @@
error: `-Zsanitizer=leak` only works with targets: x86_64-apple-darwin, x86_64-unknown-linux-gnu
error: `-Zsanitizer=leak` only works with targets: aarch64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-unknown-linux-gnu

error: aborting due to previous error

16 changes: 11 additions & 5 deletions src/tools/compiletest/src/util.rs
Expand Up @@ -82,16 +82,22 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
("xcore", "xcore"),
];

pub const ASAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["aarch64-fuchsia", "x86_64-apple-darwin", "x86_64-fuchsia", "x86_64-unknown-linux-gnu"];
pub const ASAN_SUPPORTED_TARGETS: &'static [&'static str] = &[
"aarch64-fuchsia",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-fuchsia",
"x86_64-unknown-linux-gnu",
];

pub const LSAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];

pub const MSAN_SUPPORTED_TARGETS: &'static [&'static str] = &["x86_64-unknown-linux-gnu"];
pub const MSAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"];

pub const TSAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];

pub fn matches_os(triple: &str, name: &str) -> bool {
// For the wasm32 bare target we ignore anything also ignored on emscripten
Expand Down

0 comments on commit 2851c9f

Please sign in to comment.