Skip to content

Commit 8d69a1e

Browse files
committedNov 3, 2023
Add crate compiler_builtins to LTO even if the Linkage is IncludedFromDylib
1 parent d047968 commit 8d69a1e

File tree

1 file changed

+8
-2
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+8
-2
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/link.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,14 @@ pub fn each_linked_rlib(
268268

269269
for &cnum in crates {
270270
match fmts.get(cnum.as_usize() - 1) {
271-
Some(&Linkage::NotLinked | &Linkage::Dynamic | &Linkage::IncludedFromDylib) => continue,
272-
Some(_) => {}
271+
Some(&Linkage::NotLinked | &Linkage::Dynamic) => continue,
272+
Some(&Linkage::IncludedFromDylib) => {
273+
// We always link crate `compiler_builtins` statically. When enabling LTO, we include it as well.
274+
if info.compiler_builtins != Some(cnum) {
275+
continue;
276+
}
277+
}
278+
Some(&Linkage::Static) => {}
273279
None => return Err(errors::LinkRlibError::MissingFormat),
274280
}
275281
let crate_name = info.crate_name[&cnum];

0 commit comments

Comments
 (0)
Please sign in to comment.