ld64: fix zippered binaries (#480889)

This commit is contained in:
Emily
2026-01-18 05:16:57 +00:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -73,6 +73,10 @@ stdenv.mkDerivation (finalAttrs: {
./patches/0016-Add-dyldinfo-to-the-ld64-build.patch
./patches/0017-Fix-dyldinfo-build.patch
./patches/0018-Use-STL-containers-instead-of-LLVM-containers.patch
# Fix zippered versions on macOS 26+. Part of upstream ld64-956.6. Remove on next version bump.
# https://github.com/apple-oss-distributions/ld64/commit/1a4389663d65d6630e4b3e31ace2a86b6183b452
./patches/0019-Fix-zippered-versions-macos-26.patch
];
prePatch = ''

View File

@@ -0,0 +1,13 @@
diff --git a/src/ld/Options.cpp b/src/ld/Options.cpp
--- a/src/ld/Options.cpp
+++ b/src/ld/Options.cpp
@@ -4882,7 +4885,8 @@ void Options::reconfigureDefaults()
uint32_t iOSMacOSMajorVersion = (iOSMacVersion >> 16) & 0xFFFF;
// macOS 11 -> iOSMac 14, and so on
- uint32_t newMajorVersion = macOSMajorVersion + 3;
+ uint32_t newMajorVersion = macOSMajorVersion < 26 ? macOSMajorVersion + 3 : macOSMajorVersion;
+ // rdar://154107557 (ld64 fix handling of zippered versions for macOS 26+)
if ( newMajorVersion > iOSMacOSMajorVersion ) {
uint32_t newVersion = newMajorVersion << 16;
std::string oldVersionString = getVersionString32(iOSMacVersion);