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

Perform ThinLTO on x86_64-pc-windows-msvc dist builder #128947

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
9 changes: 7 additions & 2 deletions compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,20 @@ impl<'ll> CodegenCx<'ll, '_> {
}

if !def_id.is_local() {
// Workaround an LLD bug (https://github.com/rust-lang/rust/issues/81408) with importing
// static symbols triggered by ThinLTO if we're not using -Z dylib-lto. Note this
// workaround may not be sound for crate graphs with dylibs.
let workaround_lld_bug =
self.tcx.sess.lto() == Lto::Thin && !self.tcx.sess.opts.unstable_opts.dylib_lto;

let needs_dll_storage_attr = self.use_dll_storage_attrs && !self.tcx.is_foreign_item(def_id) &&
// 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;
!self.tcx.sess.opts.cg.linker_plugin_lto.enabled() && !workaround_lld_bug;

// If this assertion triggers, there's something wrong with commandline
// argument validation.
Expand Down
1 change: 1 addition & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ auto:
--enable-full-tools
--enable-profiler
--set rust.codegen-units=1
--set rust.lto=thin
SCRIPT: python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage0-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-8c
Expand Down
Loading