Skip to content

Commit 9de12ba

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 f2023ac + 640c261 commit 9de12ba

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
@@ -1385,7 +1385,9 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
13851385
_ if codegen_results.crate_info.profiler_runtime == Some(cnum) => {
13861386
add_static_crate::<B>(cmd, sess, codegen_results, tmpdir, crate_type, cnum);
13871387
}
1388-
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) => {
1388+
_ if codegen_results.crate_info.sanitizer_runtime == Some(cnum) &&
1389+
crate_type == config::CrateType::Executable => {
1390+
// Link the sanitizer runtimes only if we are actually producing an executable
13891391
link_sanitizer_runtime::<B>(cmd, sess, codegen_results, tmpdir, cnum);
13901392
}
13911393
// compiler-builtins are always placed last to ensure that they're

0 commit comments

Comments
 (0)