about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Holler (:decoder) <choller@mozilla.com>2019-09-25 20:23:26 +0200
committerChristian Holler (:decoder) <choller@mozilla.com>2019-09-25 20:23:26 +0200
commit640c261a1f2b6bdd994670246772c15af199c65a (patch)
treea0bf182c8056f31ff1e49839933b5ac0604048f3
parent66bf391c3aabfc77f5f7139fc9e6944f995d574e (diff)
downloadrust-640c261a1f2b6bdd994670246772c15af199c65a.tar.gz
rust-640c261a1f2b6bdd994670246772c15af199c65a.zip
Only add sanitizer runtimes when linking an executable (#64629).
-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 9b044d9b453..dc73ee35aa6 100644
--- a/src/librustc_codegen_ssa/back/link.rs
+++ b/src/librustc_codegen_ssa/back/link.rs
@@ -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