mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 19:30:11 +00:00
llvmPackages_{18,19,20,21,22}.libllvm: backport Darwin triple parsing
This fixes breakage on triples for macOS 27, which aligned the Darwin
version with the OS version (darwin26 is macOS 27, but so is darwin27,
which will be incorrectly interpreted as macOS 28 without this patch).
This is probably harmless in most cases, but it causes a test failure in
LLVM’s test suite when running under macOS 27.
(cherry picked from commit 6fb7a4dc0c)
This commit is contained in:
committed by
Ihar Hrachyshka
parent
48e847bba7
commit
3692fe63c1
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Tue, 11 Aug 2026 20:12:42 -0400
|
||||
Subject: [PATCH] backport-darwin-triple-parsing
|
||||
|
||||
---
|
||||
lib/TargetParser/Triple.cpp | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/TargetParser/Triple.cpp b/lib/TargetParser/Triple.cpp
|
||||
index 0bbe8a3cedfd..4143c3eac05d 100644
|
||||
--- a/lib/TargetParser/Triple.cpp
|
||||
+++ b/lib/TargetParser/Triple.cpp
|
||||
@@ -1253,9 +1253,15 @@ bool Triple::getMacOSXVersion(VersionTuple &Version) const {
|
||||
}
|
||||
if (Version.getMajor() <= 19) {
|
||||
Version = VersionTuple(10, Version.getMajor() - 4);
|
||||
- } else {
|
||||
- // darwin20+ corresponds to macOS 11+.
|
||||
+ } else if (Version.getMajor() < 25) {
|
||||
+ // darwin20-24 corresponds to macOS 11-15.
|
||||
Version = VersionTuple(11 + Version.getMajor() - 20);
|
||||
+ } else if ((Version.getMajor() == 25) || (Version.getMajor() == 26)) {
|
||||
+ // darwin25-26 corresponds to macOS 26-27.
|
||||
+ Version = VersionTuple(Version.getMajor() + 1);
|
||||
+ } else {
|
||||
+ // Starting with darwin27, it naturally corresponds to the same macOS
|
||||
+ // version.
|
||||
}
|
||||
break;
|
||||
case MacOSX:
|
||||
--
|
||||
2.54.0
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Randy Eckenrode <randy@largeandhighquality.com>
|
||||
Date: Tue, 11 Aug 2026 20:19:29 -0400
|
||||
Subject: [PATCH] backport-darwin-triple-parsing
|
||||
|
||||
---
|
||||
lib/TargetParser/Triple.cpp | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/TargetParser/Triple.cpp b/lib/TargetParser/Triple.cpp
|
||||
index 0584c941d2e6..30cf78dbaabc 100644
|
||||
--- a/lib/TargetParser/Triple.cpp
|
||||
+++ b/lib/TargetParser/Triple.cpp
|
||||
@@ -1449,9 +1449,12 @@ bool Triple::getMacOSXVersion(VersionTuple &Version) const {
|
||||
} else if (Version.getMajor() < 25) {
|
||||
// darwin20-24 corresponds to macOS 11-15.
|
||||
Version = VersionTuple(11 + Version.getMajor() - 20);
|
||||
- } else {
|
||||
- // darwin25 corresponds with macOS26+.
|
||||
+ } else if ((Version.getMajor() == 25) || (Version.getMajor() == 26)) {
|
||||
+ // darwin25-26 corresponds to macOS 26-27.
|
||||
Version = VersionTuple(Version.getMajor() + 1);
|
||||
+ } else {
|
||||
+ // Starting with darwin27, it naturally corresponds to the same macOS
|
||||
+ // version.
|
||||
}
|
||||
break;
|
||||
case MacOSX:
|
||||
--
|
||||
2.54.0
|
||||
|
||||
@@ -222,7 +222,14 @@ stdenv.mkDerivation (
|
||||
hash = "sha256-3hkbYPUVRAtWpo5qBmc2jLZLivURMx8T0GQomvNZesc=";
|
||||
stripLen = 1;
|
||||
}
|
||||
);
|
||||
)
|
||||
++ lib.optionals (lib.versionOlder release_version "23") [
|
||||
# As of macOS 27 (and iOS 27, etc), the Darwin version number is the same as the OS version number.
|
||||
# This change breaks target parsing because `darwin27` is incorrectly interpreted as macOS 28.
|
||||
# This patch is a backport of the target parsing changes in LLVM 23, which fixes the problem.
|
||||
# Hopefully, Apple does not change the version number scheme again any time soon.
|
||||
(getVersionFile "llvm/backport-darwin-triple-parsing.patch")
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
|
||||
@@ -20,6 +20,17 @@
|
||||
path = ../18;
|
||||
}
|
||||
];
|
||||
"llvm/backport-darwin-triple-parsing.patch" = [
|
||||
{
|
||||
after = "18";
|
||||
before = "21";
|
||||
path = ../18;
|
||||
}
|
||||
{
|
||||
after = "21";
|
||||
path = ../21;
|
||||
}
|
||||
];
|
||||
"llvm/gnu-install-dirs.patch" = [
|
||||
{
|
||||
after = "23";
|
||||
|
||||
Reference in New Issue
Block a user