Skip to content

Commit 59a31c8

Browse files
committed
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.
2 parents e3cb9ea + 640c261 commit 59a31c8

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
@@ -1391,7 +1391,9 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
13911391
_ if codegen_results.crate_info.profiler_runtime == Some(cnum) => {
13921392
add_static_crate::<B>(cmd, sess, codegen_results, tmpdir, crate_type, cnum);
13931393
}
1394-
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) => {
1394+
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) &&
1395+
crate_type == config::CrateType::Executable => {
1396+
// Link the sanitizer runtimes only if we are actually producing an executable
13951397
link_sanitizer_runtime::<B>(cmd, sess, codegen_results, tmpdir, cnum);
13961398
}
13971399
// compiler-builtins are always placed last to ensure that they're

0 commit comments

Comments
 (0)