Skip to content

Commit

Permalink
Add crate compiler_builtins to LTO even if the Linkage is `Includ…
Browse files Browse the repository at this point in the history
…edFromDylib`
  • Loading branch information
DianQK committed Nov 3, 2023
1 parent d047968 commit 8d69a1e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,14 @@ pub fn each_linked_rlib(

for &cnum in crates {
match fmts.get(cnum.as_usize() - 1) {
Some(&Linkage::NotLinked | &Linkage::Dynamic | &Linkage::IncludedFromDylib) => continue,
Some(_) => {}
Some(&Linkage::NotLinked | &Linkage::Dynamic) => continue,
Some(&Linkage::IncludedFromDylib) => {
// We always link crate `compiler_builtins` statically. When enabling LTO, we include it as well.
if info.compiler_builtins != Some(cnum) {
continue;
}
}
Some(&Linkage::Static) => {}
None => return Err(errors::LinkRlibError::MissingFormat),
}
let crate_name = info.crate_name[&cnum];
Expand Down

0 comments on commit 8d69a1e

Please sign in to comment.