Update LLVM from 21 to 22 (#505)

This commit is contained in:
kvpanch authored and GitHub committed 2026-04-28 14:28:14 -04:00
1 parent 72d47e4d26
commit 8326aa3aed
49 files changed
+182 -181

No files matched your search

+2 -2
View File
@@ -82,10 +82,10 @@ Obtain a compatible build for your host platform from the release section of thi
Build artifacts end up in the `./target-llvm/gnu/target-final/` directory by default.
The `gnu` directory depends on the supported archticture and will either be `gnu`, `musl` or `emscripten`.
You now need to export the final target directory `$LLVM_SYS_211_PREFIX`:
You now need to export the final target directory `$LLVM_SYS_221_PREFIX`:
```shell
export LLVM_SYS_211_PREFIX=${PWD}/target-llvm/gnu/target-final
export LLVM_SYS_221_PREFIX=${PWD}/target-llvm/gnu/target-final
```
If built with the `--enable-tests` option, test tools will be in the `./target-llvm/gnu/build-final/` directory, along with copies of the build artifacts. For all supported build options, run `revive-llvm build --help`.
@@ -77,7 +77,6 @@ pub fn build(
llvm_module_llvm.as_path(),
llvm_build_final.as_path(),
llvm_target_final.as_path(),
musl_target.as_path(),
llvm_target_host.as_path(),
enable_tests,
enable_coverage,
@@ -269,7 +268,6 @@ fn build_target(
source_directory: &Path,
build_directory: &Path,
target_directory: &Path,
musl_target_directory: &Path,
host_target_directory: &Path,
enable_tests: bool,
enable_coverage: bool,
@@ -366,26 +364,21 @@ fn build_target(
crate::utils::ninja(build_directory)?;
let mut musl_lib_directory = musl_target_directory.to_path_buf();
musl_lib_directory.push("lib/");
let mut host_lib_directory = host_target_directory.to_path_buf();
host_lib_directory.push("lib/aarch64-unknown-linux-musl/");
let mut target_lib_directory = target_directory.to_path_buf();
target_lib_directory.push("lib/");
// Stage libc++/libunwind alongside the LLVM archives so `LLVM_SYS_221_PREFIX`
// consumers can resolve the libc++ symbols they reference. The musl sysroot
// is not copied: it would shadow the host libc on the link search path.
let copy_options = fs_extra::dir::CopyOptions {
overwrite: true,
copy_inside: true,
content_only: true,
..Default::default()
};
fs_extra::dir::copy(
musl_lib_directory,
target_lib_directory.as_path(),
&copy_options,
)?;
fs_extra::dir::copy(
host_lib_directory,
target_lib_directory.as_path(),
@@ -80,7 +80,6 @@ pub fn build(
llvm_module_llvm.as_path(),
llvm_build_final.as_path(),
llvm_target_final.as_path(),
musl_target.as_path(),
llvm_target_host.as_path(),
enable_tests,
enable_coverage,
@@ -267,7 +266,6 @@ fn build_target(
source_directory: &Path,
build_directory: &Path,
target_directory: &Path,
musl_target_directory: &Path,
host_target_directory: &Path,
enable_tests: bool,
enable_coverage: bool,
@@ -366,26 +364,21 @@ fn build_target(
crate::utils::ninja(build_directory)?;
let mut musl_lib_directory = musl_target_directory.to_path_buf();
musl_lib_directory.push("lib/");
let mut host_lib_directory = host_target_directory.to_path_buf();
host_lib_directory.push("lib/x86_64-pc-linux-musl/");
let mut target_lib_directory = target_directory.to_path_buf();
target_lib_directory.push("lib/");
// Stage libc++/libunwind alongside the LLVM archives so `LLVM_SYS_221_PREFIX`
// consumers can resolve the libc++ symbols they reference. The musl sysroot
// is not copied: it would shadow the host libc on the link search path.
let copy_options = fs_extra::dir::CopyOptions {
overwrite: true,
copy_inside: true,
content_only: true,
..Default::default()
};
fs_extra::dir::copy(
musl_lib_directory,
target_lib_directory.as_path(),
&copy_options,
)?;
fs_extra::dir::copy(
host_lib_directory,
target_lib_directory.as_path(),
@@ -7,9 +7,14 @@ use std::str::FromStr;
use anyhow::Context;
use clap::Parser;
use revive_llvm_builder::target_env::TargetEnv;
use self::arguments::{Arguments, Subcommand};
/// RUSTFLAGS required when operating in a musl target environment so that the
/// C runtime is linked dynamically rather than statically.
const MUSL_RUSTFLAGS: &str = "-Ctarget-feature=-crt-static";
fn main() {
env_logger::init();
@@ -25,6 +30,10 @@ fn main() {
fn main_inner() -> anyhow::Result<()> {
let arguments = Arguments::parse();
if arguments.target_env == TargetEnv::MUSL {
std::env::set_var("RUSTFLAGS", MUSL_RUSTFLAGS);
}
revive_llvm_builder::utils::directory_target_llvm(arguments.target_env);
match arguments.subcommand {