File tree 1 file changed +7
-1
lines changed
compiler/rustc_codegen_ssa/src/back
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -2165,8 +2165,14 @@ fn msvc_imps_needed(tcx: TyCtxt<'_>) -> bool {
2165
2165
&& tcx. sess. opts. cg. prefer_dynamic)
2166
2166
) ;
2167
2167
2168
+ // We need to generate _imp__ symbol if we are generating an rlib or we include one
2169
+ // indirectly from ThinLTO. In theory these are not needed as ThinLTO could resolve
2170
+ // these, but it currently does not do so.
2171
+ let can_have_static_objects =
2172
+ tcx. sess . lto ( ) == Lto :: Thin || tcx. crate_types ( ) . iter ( ) . any ( |ct| * ct == CrateType :: Rlib ) ;
2173
+
2168
2174
tcx. sess . target . is_like_windows &&
2169
- tcx . crate_types ( ) . iter ( ) . any ( |ct| * ct == CrateType :: Rlib ) &&
2175
+ can_have_static_objects &&
2170
2176
// ThinLTO can't handle this workaround in all cases, so we don't
2171
2177
// emit the `__imp_` symbols. Instead we make them unnecessary by disallowing
2172
2178
// dynamic linking when linker plugin LTO is enabled.
You can’t perform that action at this time.
0 commit comments