Skip to content
Closed
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
17 changes: 14 additions & 3 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use build_helper::{output, t};

use crate::{Compiler, Mode, LLVM_TOOLS};
use crate::channel;
use crate::util::{is_dylib, exe};
use crate::util::{is_dylib, exe, libdir};
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::compile;
use crate::tool::{self, Tool};
Expand Down Expand Up @@ -2047,8 +2047,8 @@ pub fn maybe_install_llvm_dylib(builder: &Builder<'_>,
sysroot: &Path) {
let src_libdir = builder
.llvm_out(target)
.join("lib");
let dst_libdir = sysroot.join("lib/rustlib").join(&*target).join("lib");
.join(libdir(&target));
let dst_libdir = sysroot.join("lib").join("rustlib").join(&*target).join("lib");
t!(fs::create_dir_all(&dst_libdir));

if target.contains("apple-darwin") {
Expand All @@ -2059,6 +2059,17 @@ pub fn maybe_install_llvm_dylib(builder: &Builder<'_>,
return
}

// Install the LLVM-C library for Windows as LLVM does not support
// creating a C++ shared library there.
// This is done because rust-ptx-linker requires LLVM.
if target.contains("pc-windows") {
let llvm_dylib_path = src_libdir.join("LLVM-C.dll");
if llvm_dylib_path.exists() {
builder.install(&llvm_dylib_path, &dst_libdir, 0o644);
}
return
}

// Usually libLLVM.so is a symlink to something like libLLVM-6.0.so.
// Since tools link to the latter rather than the former, we have to
// follow the symlink to find out what to distribute.
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ impl Step for Llvm {
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
}

if target.contains("pc-windows") {
cfg.define("LLVM_BUILD_LLVM_C_DYLIB", "ON");
}

// For distribution we want the LLVM tools to be *statically* linked to libstdc++
if builder.config.llvm_tools_enabled || want_lldb {
if !target.contains("windows") {
Expand Down