diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2024-08-14 08:40:30 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2024-09-22 11:37:21 +0200 |
| commit | b7a490ab33942806e3783c829ad497c982bd6f1a (patch) | |
| tree | ba44d9fbb12536682532a8495c9e475ef8733175 /compiler/rustc_codegen_ssa | |
| parent | 1f9a018fa30a13150b5e3b308d1aa16f86e27ecb (diff) | |
Create _imp__ symbols also when doing ThinLTO
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index c170cd41ec4..a23365025bc 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -2165,8 +2165,14 @@ fn msvc_imps_needed(tcx: TyCtxt<'_>) -> bool { && tcx.sess.opts.cg.prefer_dynamic) ); + // We need to generate _imp__ symbol if we are generating an rlib or we include one + // indirectly from ThinLTO. In theory these are not needed as ThinLTO could resolve + // these, but it currently does not do so. + let can_have_static_objects = + tcx.sess.lto() == Lto::Thin || tcx.crate_types().iter().any(|ct| *ct == CrateType::Rlib); + tcx.sess.target.is_like_windows && - tcx.crate_types().iter().any(|ct| *ct == CrateType::Rlib) && + can_have_static_objects && // ThinLTO can't handle this workaround in all cases, so we don't // emit the `__imp_` symbols. Instead we make them unnecessary by disallowing // dynamic linking when linker plugin LTO is enabled. |
