[meta] Upgrade LLVM 16 to 17

This commit is contained in:
2026-03-27 18:35:28 +08:00
parent b0e960b4c7
commit d1816b5bc5
7 changed files with 19 additions and 32 deletions

13
Cargo.lock generated
View File

@@ -595,14 +595,15 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "llvm-sys"
version = "160.2.1"
version = "170.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e73861901245d32e1c3d8b35b639cf100859b4cd0c9da56fe0273040acbb3ea4"
checksum = "1a5e5f51e78d53a09a9e7763d700d34859f3cc45a8fb9eaad2e8555bc84ff2a0"
dependencies = [
"anyhow",
"cc",
"lazy_static",
"libc",
"regex",
"regex-lite",
"semver",
]
@@ -1059,6 +1060,12 @@ dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-lite"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973"
[[package]]
name = "regex-syntax"
version = "0.8.10"

View File

@@ -97,7 +97,7 @@
doCheck = false;
configurePhase = ''
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-L${compiler-rt}/x86_64-unknown-linux-gnu -C link-arg=-lclang_rt.profile"
export LLVM_SYS_160_PREFIX=${llvm-nac3-instrumented}
export LLVM_SYS_170_PREFIX=${llvm-nac3-instrumented}
'';
installPhase = ''
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}

View File

@@ -23,7 +23,7 @@ strum_macros = "0.28"
[dependencies.inkwell]
version = "0.8"
default-features = false
features = ["llvm16-0-prefer-dynamic", "target-x86", "target-arm", "target-riscv", "no-libffi-linking", "typed-pointers"]
features = ["llvm17-0-prefer-dynamic", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]
[dev-dependencies]
test-case = "3.3"

View File

@@ -36,8 +36,6 @@ fn main() {
"-fno-exceptions",
"-fno-rtti",
"-emit-llvm",
"-Xclang",
"-no-opaque-pointers",
"-S",
"-Wall",
"-Wextra",
@@ -107,7 +105,6 @@ fn main() {
let mut llvm_as = Command::new("llvm-as-irrt")
.stdin(Stdio::piped())
.arg("-opaque-pointers=0")
.arg("-o")
.arg(out_dir.join("irrt.bc"))
.spawn()

View File

@@ -79,24 +79,7 @@ in rec {
mkdir cmake
ln -s $PWD/llvm/cmake cmake/Modules
'';
patches =
lib.lists.flatten (map (proj:
if proj == "clang"
then [
# clang ignores all "compile-only options" if it only performs linkage.
# "Include path options" are "compile-only options".
# However, clang-16 does not identify options such as -nostdlibinc as "include path options".
# Hence, clang-16 always emit unused arguments warning when only linking.
#
# TODO: Remove when updating llvm.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/5b77e752dcd073846b89559d6c0e1a7699e58615.patch";
sha256 = "sha256-W81hy5EWlRIpqu7BEEem+EKPFgHn3rYychH3cnD5aDc=";
})
]
else [])
enableProjects)
++ optionals (msys2-env == null) ([
patches = optionals (msys2-env == null) ([
# Aggregate of 2 merged patches:
# https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1.patch
# https://github.com/llvm/llvm-project/commit/7abf44069aec61eee147ca67a6333fc34583b524.patch

View File

@@ -1,19 +1,19 @@
{fetchurl}: rec {
version = "16.0.6";
version = "17.0.6";
cmake = fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/cmake-${version}.src.tar.xz";
hash = "sha256-OdNCpBYQldLyj7ElPkWFl4rFBSERfaZm4rH28oti9RQ=";
hash = "sha256-gH8GnFTcIMtHshwfasr92cZJ864BVgkEDWGCyrARQPQ=";
};
llvm = fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz";
hash = "sha256-6R20TRs7scM/zqmn0fJCO4g+qpFj09VsoqptLwcRvCk=";
hash = "sha256-tjgWfaE5EmyhGRe2iAIHzG6PnRy7GkjYfQF/aX73gYg=";
};
clang = fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz";
hash = "sha256-EYa25u7+rdCZEu1zs3KehbWfBDckuygYqVouwCRXGEA=";
hash = "sha256-p49minJq4dPZpxeZltl7ErkPt2q5RCpDEQuXL/etkCk=";
};
compiler-rt = fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz";
hash = "sha256-eRGiqcyhA5Ohf2N8Aab1VVsKOPZP9H3JFoQTpBkLwts=";
hash = "sha256-EbjQnc+SoPkcXILe+1rZ/0rPXPBzqAwxcgS6qSLRNrQ=";
};
}

View File

@@ -54,7 +54,7 @@ in rec {
${silenceFontconfig}
export PYO3_CONFIG_FILE=Z:${pyo3-mingw-config}
export CC=clang
export LLVM_SYS_160_PREFIX=Z:${llvm}
export LLVM_SYS_170_PREFIX=Z:${llvm}
wine cargo build --release -p nac3artiq
'';
installPhase = ''