Auto merge of #64780 - choller:master, r=michaelwoerister

Only add sanitizer runtimes when linking an executable (#64629).

This change modifies the code to only add sanitizer runtimes if we are linking an executable, as those runtimes should never be part of libraries. I successfully compiled `mozilla-central` with ASan using this patch.
This commit is contained in:
bors 2019-10-07 13:23:00 +00:00
commit 59a31c8c67
1 changed files with 3 additions and 1 deletions

View File

@ -1391,7 +1391,9 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
_ 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