diff options
| author | dianqk <dianqk@dianqk.net> | 2023-11-02 23:13:12 +0800 |
|---|---|---|
| committer | DianQK <dianqk@dianqk.net> | 2023-11-03 08:29:15 +0800 |
| commit | 8d69a1e69e61fe71b1672950ffc6bb28269c314d (patch) | |
| tree | d84ff199feb167741d81700cb43f0d9e7690298a /compiler/rustc_codegen_ssa/src/back | |
| parent | d047968462d3800b31606db911b60cdcd895b9d2 (diff) | |
| download | rust-8d69a1e69e61fe71b1672950ffc6bb28269c314d.tar.gz rust-8d69a1e69e61fe71b1672950ffc6bb28269c314d.zip | |
Add crate `compiler_builtins` to LTO even if the `Linkage` is `IncludedFromDylib`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 535b594649c..586bcaa80e3 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -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]; |
