Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply dllimport in ThinLTO #122790

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use rustc_middle::mir::mono::MonoItem;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance};
use rustc_middle::{bug, span_bug};
use rustc_session::config::Lto;
use rustc_target::abi::{
Align, AlignFromBytesError, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
};
Expand Down Expand Up @@ -325,11 +324,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.
Expand Down
13 changes: 0 additions & 13 deletions tests/codegen/issues/auxiliary/static_dllimport_aux.rs

This file was deleted.

15 changes: 0 additions & 15 deletions tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs

This file was deleted.

Loading