Auto merge of #121395 - nikic:update-llvm-21, r=cuviper
Update to LLVM 18.1.0 rc 4 Fixes https://github.com/rust-lang/rust/issues/120819. Fixes https://github.com/rust-lang/rust/issues/121180. Fixes https://github.com/rust-lang/rust/issues/121239. Fixes https://github.com/rust-lang/rust/issues/121367.
This commit is contained in:
commit
e612d079a1
@ -2021,18 +2021,39 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn install_llvm_file(builder: &Builder<'_>, source: &Path, destination: &Path) {
|
fn install_llvm_file(
|
||||||
|
builder: &Builder<'_>,
|
||||||
|
source: &Path,
|
||||||
|
destination: &Path,
|
||||||
|
install_symlink: bool,
|
||||||
|
) {
|
||||||
if builder.config.dry_run() {
|
if builder.config.dry_run() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.install(source, destination, 0o644);
|
if source.is_symlink() {
|
||||||
|
// If we have a symlink like libLLVM-18.so -> libLLVM.so.18.1, install the target of the
|
||||||
|
// symlink, which is what will actually get loaded at runtime.
|
||||||
|
builder.install(&t!(fs::canonicalize(source)), destination, 0o644);
|
||||||
|
if install_symlink {
|
||||||
|
// If requested, also install the symlink. This is used by download-ci-llvm.
|
||||||
|
let full_dest = destination.join(source.file_name().unwrap());
|
||||||
|
builder.copy(&source, &full_dest);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder.install(&source, destination, 0o644);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking.
|
/// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking.
|
||||||
///
|
///
|
||||||
/// Returns whether the files were actually copied.
|
/// Returns whether the files were actually copied.
|
||||||
fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir: &Path) -> bool {
|
fn maybe_install_llvm(
|
||||||
|
builder: &Builder<'_>,
|
||||||
|
target: TargetSelection,
|
||||||
|
dst_libdir: &Path,
|
||||||
|
install_symlink: bool,
|
||||||
|
) -> bool {
|
||||||
// If the LLVM was externally provided, then we don't currently copy
|
// If the LLVM was externally provided, then we don't currently copy
|
||||||
// artifacts into the sysroot. This is not necessarily the right
|
// artifacts into the sysroot. This is not necessarily the right
|
||||||
// choice (in particular, it will require the LLVM dylib to be in
|
// choice (in particular, it will require the LLVM dylib to be in
|
||||||
@ -2081,7 +2102,7 @@ fn maybe_install_llvm(builder: &Builder<'_>, target: TargetSelection, dst_libdir
|
|||||||
} else {
|
} else {
|
||||||
PathBuf::from(file)
|
PathBuf::from(file)
|
||||||
};
|
};
|
||||||
install_llvm_file(builder, &file, dst_libdir);
|
install_llvm_file(builder, &file, dst_libdir, install_symlink);
|
||||||
}
|
}
|
||||||
!builder.config.dry_run()
|
!builder.config.dry_run()
|
||||||
} else {
|
} else {
|
||||||
@ -2096,7 +2117,7 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection,
|
|||||||
// dynamically linked; it is already included into librustc_llvm
|
// dynamically linked; it is already included into librustc_llvm
|
||||||
// statically.
|
// statically.
|
||||||
if builder.llvm_link_shared() {
|
if builder.llvm_link_shared() {
|
||||||
maybe_install_llvm(builder, target, &dst_libdir);
|
maybe_install_llvm(builder, target, &dst_libdir, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2108,7 +2129,7 @@ pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection
|
|||||||
// dynamically linked; it is already included into librustc_llvm
|
// dynamically linked; it is already included into librustc_llvm
|
||||||
// statically.
|
// statically.
|
||||||
if builder.llvm_link_shared() {
|
if builder.llvm_link_shared() {
|
||||||
maybe_install_llvm(builder, target, &dst_libdir);
|
maybe_install_llvm(builder, target, &dst_libdir, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2203,6 +2224,8 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
|||||||
|
|
||||||
let mut tarball = Tarball::new(builder, "rust-dev", &target.triple);
|
let mut tarball = Tarball::new(builder, "rust-dev", &target.triple);
|
||||||
tarball.set_overlay(OverlayKind::LLVM);
|
tarball.set_overlay(OverlayKind::LLVM);
|
||||||
|
// LLVM requires a shared object symlink to exist on some platforms.
|
||||||
|
tarball.permit_symlinks(true);
|
||||||
|
|
||||||
builder.ensure(crate::core::build_steps::llvm::Llvm { target });
|
builder.ensure(crate::core::build_steps::llvm::Llvm { target });
|
||||||
|
|
||||||
@ -2243,7 +2266,7 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
|||||||
// of `rustc-dev` to support the inherited `-lLLVM` when using the
|
// of `rustc-dev` to support the inherited `-lLLVM` when using the
|
||||||
// compiler libraries.
|
// compiler libraries.
|
||||||
let dst_libdir = tarball.image_dir().join("lib");
|
let dst_libdir = tarball.image_dir().join("lib");
|
||||||
maybe_install_llvm(builder, target, &dst_libdir);
|
maybe_install_llvm(builder, target, &dst_libdir, true);
|
||||||
let link_type = if builder.llvm_link_shared() { "dynamic" } else { "static" };
|
let link_type = if builder.llvm_link_shared() { "dynamic" } else { "static" };
|
||||||
t!(std::fs::write(tarball.image_dir().join("link-type.txt"), link_type), dst_libdir);
|
t!(std::fs::write(tarball.image_dir().join("link-type.txt"), link_type), dst_libdir);
|
||||||
|
|
||||||
|
@ -98,9 +98,6 @@ pub fn prebuilt_llvm_config(
|
|||||||
let out_dir = builder.llvm_out(target);
|
let out_dir = builder.llvm_out(target);
|
||||||
|
|
||||||
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
|
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
|
||||||
if (!builder.config.build.is_msvc() || builder.ninja()) && !builder.config.llvm_from_ci {
|
|
||||||
llvm_config_ret_dir.push("build");
|
|
||||||
}
|
|
||||||
llvm_config_ret_dir.push("bin");
|
llvm_config_ret_dir.push("bin");
|
||||||
let build_llvm_config = llvm_config_ret_dir.join(exe("llvm-config", builder.config.build));
|
let build_llvm_config = llvm_config_ret_dir.join(exe("llvm-config", builder.config.build));
|
||||||
let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");
|
let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 9ea7f739f257b049a65deeb1f2455bb2ea021cfa
|
Subproject commit 7973f3560287d750500718314a0fd4025bd8ac0e
|
@ -270,7 +270,8 @@ fn execute_pipeline(
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
let libdir = env.build_artifacts().join("stage2").join("lib");
|
let libdir = env.build_artifacts().join("stage2").join("lib");
|
||||||
let llvm_lib = io::find_file_in_dir(&libdir, "libLLVM", ".so")?;
|
// The actual name will be something like libLLVM.so.18.1-rust-dev.
|
||||||
|
let llvm_lib = io::find_file_in_dir(&libdir, "libLLVM.so", "")?;
|
||||||
|
|
||||||
log::info!("Optimizing {llvm_lib} with BOLT");
|
log::info!("Optimizing {llvm_lib} with BOLT");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user