@@ -16,7 +16,6 @@ use rustc_middle::mir::mono::MonoItem;
1616use rustc_middle:: ty:: Instance ;
1717use rustc_middle:: ty:: layout:: { HasTypingEnv , LayoutOf } ;
1818use rustc_middle:: { bug, span_bug} ;
19- use rustc_session:: config:: Lto ;
2019use tracing:: { debug, instrument, trace} ;
2120
2221use crate :: common:: { AsCCharPtr , CodegenCx } ;
@@ -344,11 +343,11 @@ impl<'ll> CodegenCx<'ll, '_> {
344343 // Local definitions can never be imported, so we must not apply
345344 // the DLLImport annotation.
346345 && !dso_local
347- // ThinLTO can 't handle this workaround in all cases, so we don't
348- // emit the attrs . Instead we make them unnecessary by disallowing
349- // dynamic linking when linker plugin based LTO is enabled.
350- && ! self . tcx . sess . opts . cg . linker_plugin_lto . enabled ( )
351- && self . tcx . sess . lto ( ) != Lto :: Thin ;
346+ // Linker plugin ThinLTO doesn 't create the self-dllimport Rust uses for rlibs
347+ // as the code generation happens out of process . Instead we assume static linkage
348+ // and disallow dynamic linking when linker plugin based LTO is enabled.
349+ // Regular in-process ThinLTO doesn't need this workaround.
350+ && ! self . tcx . sess . opts . cg . linker_plugin_lto . enabled ( ) ;
352351
353352 // If this assertion triggers, there's something wrong with commandline
354353 // argument validation.
0 commit comments