From 00e3b26b8186b5b74ab938dfa22f6e773a1e33a8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 21 Feb 2024 09:35:38 +0100 Subject: [PATCH 1/2] Update to LLVM 18.1.0 rc 3 --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 9ea7f739f257b..edb85c30900a3 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 9ea7f739f257b049a65deeb1f2455bb2ea021cfa +Subproject commit edb85c30900a383b90e3235f1637ce737b0d057c From bb1d57bacb858db273c01977521df83986f67b8a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 22 Feb 2024 11:55:09 +0100 Subject: [PATCH 2/2] Handle new LLVM soname LLVM now includes the minor version in the soname, and also changed the names of library files. libLLVM-18.so is now a symlink to libLLVM.so.18.1. We need to make two changes to support this: First, we need to run the installed llvm-config binary, rather than the one from the build directory. This is because the symlink does not exist in the build directory, but llvm-config requires it. This looks like an LLVM bug to me, but it's probably a good idea to use the installed version anyway. Second, when installing LLVM into the libdir, we need to follow the symlink from libLLVM-18.so to libLLVM.so.18.1, as this is what will actually get loaded at runtime. --- src/bootstrap/src/core/build_steps/dist.rs | 8 +++++++- src/bootstrap/src/core/build_steps/llvm.rs | 3 --- src/tools/opt-dist/src/main.rs | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index d9ab18e7250b0..9f6a24228d95f 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2026,7 +2026,13 @@ fn install_llvm_file(builder: &Builder<'_>, source: &Path, destination: &Path) { return; } - builder.install(source, destination, 0o644); + if source.is_symlink() { + // Follow symlinks. E.g. if we're linking against libLLVM-18.so, then what gets loaded + // at runtime is libLLVM.so.18.1. + builder.install(&t!(fs::canonicalize(source)), destination, 0o644); + } else { + builder.install(&source, destination, 0o644); + } } /// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking. diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 9622321a74e7c..9e42102f0221b 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -98,9 +98,6 @@ pub fn prebuilt_llvm_config( let out_dir = builder.llvm_out(target); 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"); 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"); diff --git a/src/tools/opt-dist/src/main.rs b/src/tools/opt-dist/src/main.rs index f9ff1a0a48603..ffb01210e0455 100644 --- a/src/tools/opt-dist/src/main.rs +++ b/src/tools/opt-dist/src/main.rs @@ -270,7 +270,8 @@ fn execute_pipeline( })?; 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");