about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-07 13:23:00 +0000
committerbors <bors@rust-lang.org>2019-10-07 13:23:00 +0000
commit59a31c8c676bdc9f50490d5798b1b4e884b7d7ae (patch)
treeff98746284824f7c7e7eac5ba768d390b0765ce2
parente3cb9ea15a2082f39d4d4f10a22e779701dd0d64 (diff)
parent640c261a1f2b6bdd994670246772c15af199c65a (diff)
downloadrust-59a31c8c676bdc9f50490d5798b1b4e884b7d7ae.tar.gz
rust-59a31c8c676bdc9f50490d5798b1b4e884b7d7ae.zip
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.
-rw-r--r--src/librustc_codegen_ssa/back/link.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs
index 50d9c088a85..18e740c0e77 100644
--- a/src/librustc_codegen_ssa/back/link.rs
+++ b/src/librustc_codegen_ssa/back/link.rs
@@ -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