Skip to content

Commit

Permalink
Auto merge of #64780 - choller:master, r=michaelwoerister
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 7, 2019
2 parents e3cb9ea + 640c261 commit 59a31c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_codegen_ssa/back/link.rs
Expand Up @@ -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
Expand Down

0 comments on commit 59a31c8

Please sign in to comment.