Skip to content

Commit

Permalink
Only add sanitizer runtimes when linking an executable (#64629).
Browse files Browse the repository at this point in the history
  • Loading branch information
choller committed Sep 25, 2019
1 parent 66bf391 commit 640c261
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,9 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
_ if codegen_results.crate_info.profiler_runtime == Some(cnum) => {
add_static_crate::<B>(cmd, sess, codegen_results, tmpdir, crate_type, cnum);
}
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) => {
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) &&
crate_type == config::CrateType::Executable => {
// Link the sanitizer runtimes only if we are actually producing an executable
link_sanitizer_runtime::<B>(cmd, sess, codegen_results, tmpdir, cnum);
}
// compiler-builtins are always placed last to ensure that they're
Expand Down

0 comments on commit 640c261

Please sign in to comment.