Skip to content

Commit fabbb47

Browse files
Rollup merge of rust-lang#152609 - mati865:gnullvm-llvm-dll, r=bjorn3
Install LLVM DLL in the right place on Windows Continuation of rust-lang#151795 towards rust-lang#151774. Unlike other systems, Windows requires runtime libraries to be present in `PATH` or right next to the binary. So, we copy the library next to the binary as the easier solution. Tested building `rust-openssl` in debug and release modes, but the difference is within noise margin.
2 parents 2219766 + 585297c commit fabbb47

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ pub fn walk_native_lib_search_dirs<R>(
7171
|| sess.target.os == Os::Fuchsia
7272
|| sess.target.is_like_aix
7373
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
74+
// FIXME: For the shared LLVM library.
75+
|| sess.target.os == Os::Windows && sess.target.env == Env::Gnu && sess.target.abi == Abi::Llvm
7476
{
7577
f(&sess.target_tlib_path.dir, false)?;
7678
}

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2557,7 +2557,7 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection,
25572557
),
25582558
)]
25592559
pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
2560-
let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler::new(1, target)));
2560+
let dst_libdir = sysroot.join(builder.libdir_relative(Compiler::new(1, target)));
25612561
// We do not need to copy LLVM files into the sysroot if it is not
25622562
// dynamically linked; it is already included into librustc_llvm
25632563
// statically.

src/ci/github-actions/jobs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ auto:
712712
--target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm
713713
--enable-full-tools
714714
--enable-profiler
715+
--enable-llvm-link-shared
715716
DIST_REQUIRE_ALL_TOOLS: 1
716717
CODEGEN_BACKENDS: llvm,cranelift
717718
CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang
@@ -724,6 +725,7 @@ auto:
724725
--build=x86_64-pc-windows-gnullvm
725726
--enable-full-tools
726727
--enable-profiler
728+
--enable-llvm-link-shared
727729
DIST_REQUIRE_ALL_TOOLS: 1
728730
CODEGEN_BACKENDS: llvm,cranelift
729731
<<: *job-windows

0 commit comments

Comments
 (0)