llvmPackages: add comments for all patches in LLVM and CLang

Co-Authored-By: Silvan Mosberger <silvan.mosberger@moduscreate.com>
This commit is contained in:
Silvan Mosberger
2025-04-30 11:55:26 +04:00
committed by Alexander Bantyev
parent 00a5791030
commit bc2b4e77d8
2 changed files with 17 additions and 2 deletions
@@ -48,6 +48,7 @@ stdenv.mkDerivation (
patches =
[
(getVersionFile "clang/purity.patch")
# Remove extraneous ".a" suffix from baremetal clang_rt.builtins when compiling for baremetal.
# https://reviews.llvm.org/D51899
(getVersionFile "clang/gnu-install-dirs.patch")
]
@@ -76,6 +77,7 @@ stdenv.mkDerivation (
else
./ignore-nostd-link-13.diff
)
# Pass the correct path to libllvm
++ [
(replaceVars
(
@@ -112,6 +114,8 @@ stdenv.mkDerivation (
stripLen = 1;
hash = "sha256-Vs32kql7N6qtLqc12FtZHURcbenA7+N3E/nRRX3jdig=";
})
# Fixes a bunch of lambda-related crashes
# https://github.com/llvm/llvm-project/pull/93206
++ lib.optional (lib.versions.major release_version == "18") (fetchpatch {
name = "tweak-tryCaptureVariable-for-unevaluated-lambdas.patch";
url = "https://github.com/llvm/llvm-project/commit/3d361b225fe89ce1d8c93639f27d689082bd8dad.patch";
@@ -123,8 +123,14 @@ stdenv.mkDerivation (
];
patches =
lib.optional (lib.versionOlder release_version "14") ./llvm-config-link-static.patch
lib.optional (lib.versionOlder release_version "14")
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
./llvm-config-link-static.patch
++ lib.optionals (lib.versions.major release_version == "12") [
# Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955
(getVersionFile "llvm/fix-llvm-issue-49955.patch")
# On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
@@ -135,6 +141,9 @@ stdenv.mkDerivation (
stripLen = 1;
})
]
# Support custom installation dirs
# Originally based off https://reviews.llvm.org/D99484
# Latest state: https://github.com/llvm/llvm-project/pull/125376
++ [ (getVersionFile "llvm/gnu-install-dirs.patch") ]
++ lib.optionals (lib.versionAtLeast release_version "15") [
# Running the tests involves invoking binaries (like `opt`) that depend on
@@ -241,7 +250,8 @@ stdenv.mkDerivation (
]
++
lib.optional (lib.versions.major release_version == "17")
# resolves https://github.com/llvm/llvm-project/issues/75168
# Fixes a crash with -fzero-call-used-regs=used-gpr
# See also https://github.com/llvm/llvm-project/issues/75168
(
fetchpatch {
name = "fix-fzero-call-used-regs.patch";
@@ -278,6 +288,7 @@ stdenv.mkDerivation (
})
]
++ lib.optionals enablePolly [
# Just like the `gnu-install-dirs` patch, but for `polly`.
(getVersionFile "llvm/gnu-install-dirs-polly.patch")
]
++