about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-09 18:32:36 +0000
committerbors <bors@rust-lang.org>2025-03-09 18:32:36 +0000
commit3ea711f17e3946ac3f4df11691584e2c56b4b0cf (patch)
treed55170fd23cd390502ead3a0d0cf80a1aabc73d9 /compiler/rustc_codegen_llvm/src
parent385970f0c1fd0c09bac426b02f38300c0b1ba9a2 (diff)
parent33530e4cb9d614c170f90b57d4e748b11e11cfec (diff)
downloadrust-3ea711f17e3946ac3f4df11691584e2c56b4b0cf.tar.gz
rust-3ea711f17e3946ac3f4df11691584e2c56b4b0cf.zip
Auto merge of #138279 - matthiaskrgr:rollup-ndnoipr, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #122790 (Apply dllimport in ThinLTO)
 - #137650 (Move `fs` into `sys`)
 - #138228 (Use `disjoint_bitor` inside `borrowing_sub`)
 - #138233 (Windows: Don't link std (and run-make) against advapi32, except on win7)
 - #138253 (Continue to check attr if meet empty repr for adt)
 - #138263 (Fix `repr128-dwarf` test)
 - #138276 (Lazy load NtOpenFile for UWP)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index 0dec0d869b0..a4e5749b3ac 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -16,7 +16,6 @@ use rustc_middle::mir::mono::MonoItem;
 use rustc_middle::ty::Instance;
 use rustc_middle::ty::layout::{HasTypingEnv, LayoutOf};
 use rustc_middle::{bug, span_bug};
-use rustc_session::config::Lto;
 use tracing::{debug, instrument, trace};
 
 use crate::common::{AsCCharPtr, CodegenCx};
@@ -344,11 +343,11 @@ impl<'ll> CodegenCx<'ll, '_> {
                 // Local definitions can never be imported, so we must not apply
                 // the DLLImport annotation.
                 && !dso_local
-                // ThinLTO can't handle this workaround in all cases, so we don't
-                // emit the attrs. Instead we make them unnecessary by disallowing
-                // dynamic linking when linker plugin based LTO is enabled.
-                && !self.tcx.sess.opts.cg.linker_plugin_lto.enabled()
-                && self.tcx.sess.lto() != Lto::Thin;
+                // Linker plugin ThinLTO doesn't create the self-dllimport Rust uses for rlibs
+                // as the code generation happens out of process. Instead we assume static linkage
+                // and disallow dynamic linking when linker plugin based LTO is enabled.
+                // Regular in-process ThinLTO doesn't need this workaround.
+                && !self.tcx.sess.opts.cg.linker_plugin_lto.enabled();
 
             // If this assertion triggers, there's something wrong with commandline
             // argument validation.