@@ -16,7 +16,6 @@ use rustc_middle::mir::mono::MonoItem;
16
16
use rustc_middle:: ty:: Instance ;
17
17
use rustc_middle:: ty:: layout:: { HasTypingEnv , LayoutOf } ;
18
18
use rustc_middle:: { bug, span_bug} ;
19
- use rustc_session:: config:: Lto ;
20
19
use tracing:: { debug, instrument, trace} ;
21
20
22
21
use crate :: common:: { AsCCharPtr , CodegenCx } ;
@@ -344,11 +343,11 @@ impl<'ll> CodegenCx<'ll, '_> {
344
343
// Local definitions can never be imported, so we must not apply
345
344
// the DLLImport annotation.
346
345
&& !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 ( ) ;
352
351
353
352
// If this assertion triggers, there's something wrong with commandline
354
353
// argument validation.
0 commit comments