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
9 changes: 5 additions & 4 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::utils::build_stamp::{self, BuildStamp};
use crate::utils::channel::{self, Info};
use crate::utils::exec::{BootstrapCommand, command};
use crate::utils::helpers::{
exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
exe, is_dylib, libdir, move_file, t, target_supports_cranelift_backend, timeit,
};
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::{CodegenBackendKind, Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace};
Expand Down Expand Up @@ -2518,7 +2518,7 @@ fn maybe_install_llvm(
}
}

/// Maybe add libLLVM.so to the target lib-dir for linking.
/// Maybe add libLLVM.so to the target runtime lib-dir.
#[cfg_attr(
feature = "tracing",
instrument(
Expand All @@ -2533,7 +2533,7 @@ fn maybe_install_llvm(
),
)]
pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
let dst_libdir = sysroot.join("lib/rustlib").join(target).join("lib");
let dst_libdir = sysroot.join("lib/rustlib").join(target).join(libdir(target));
// We do not need to copy LLVM files into the sysroot if it is not
// dynamically linked; it is already included into librustc_llvm
// statically.
Expand All @@ -2557,7 +2557,8 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection,
),
)]
pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler::new(1, target)));
let dst_libdir =
sysroot.join(builder.sysroot_runtime_libdir_relative(Compiler::new(1, target)));
// We do not need to copy LLVM files into the sysroot if it is not
// dynamically linked; it is already included into librustc_llvm
// statically.
Expand Down
19 changes: 19 additions & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,25 @@ Alternatively, you can set `build.local-rebuild=true` and use a stage0 compiler
}
}

/// Returns the compiler's relative runtime libdir where shared libraries are found for a
/// compiler's sysroot.
///
/// For example this returns `lib` on Unix and `bin` on Windows.
pub fn sysroot_runtime_libdir_relative(&self, compiler: Compiler) -> PathBuf {
let adjust_path = |path: &Path| -> PathBuf {
if compiler.host.is_windows() || compiler.host.contains("cygwin") {
path.parent().expect("original path should point to `lib` already").join("bin")
} else {
path.to_owned()
}
};
match self.config.libdir_relative() {
Some(relative_libdir) if compiler.stage >= 1 => adjust_path(relative_libdir),
_ if compiler.stage == 0 => adjust_path(&self.build.initial_relative_libdir),
_ => PathBuf::from(libdir(compiler.host)),
}
}

pub fn rustc_lib_paths(&self, compiler: Compiler) -> Vec<PathBuf> {
let mut dylib_dirs = vec![self.rustc_libdir(compiler)];

Expand Down
2 changes: 2 additions & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ auto:
--target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm
--enable-full-tools
--enable-profiler
--enable-llvm-link-shared
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang
Expand All @@ -703,6 +704,7 @@ auto:
--build=x86_64-pc-windows-gnullvm
--enable-full-tools
--enable-profiler
--enable-llvm-link-shared
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-windows
Expand Down
Loading