Skip to content

Commit 640c261

Browse files
committed
Only add sanitizer runtimes when linking an executable (#64629).
1 parent 66bf391 commit 640c261

File tree

1 file changed

+3
-1
lines changed
  • src/librustc_codegen_ssa/back

1 file changed

+3
-1
lines changed

src/librustc_codegen_ssa/back/link.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,9 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
13721372
_ if codegen_results.crate_info.profiler_runtime == Some(cnum) => {
13731373
add_static_crate::<B>(cmd, sess, codegen_results, tmpdir, crate_type, cnum);
13741374
}
1375-
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) => {
1375+
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) &&
1376+
crate_type == config::CrateType::Executable => {
1377+
// Link the sanitizer runtimes only if we are actually producing an executable
13761378
link_sanitizer_runtime::<B>(cmd, sess, codegen_results, tmpdir, cnum);
13771379
}
13781380
// compiler-builtins are always placed last to ensure that they're

0 commit comments

Comments
 (0)