Skip to content

Commit 015adcc

Browse files
authored
Merge pull request #197 from p-x9/feature/prebuild-loader-dyld-1241.17
2 parents 6682a1f + 391eed8 commit 015adcc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Sources/MachOKit/Model/DyldCache/Loader/PrebuiltLoaderSet.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public struct PrebuiltLoaderSet: LayoutWrapper {
1717

1818
extension PrebuiltLoaderSet {
1919
public func loaders(in cache: DyldCache) -> [PrebuiltLoader]? {
20-
guard isLatestVersion else { return nil }
20+
if let version, version.isPre1165_3 {
21+
return nil
22+
}
2123

2224
guard let offset = cache.fileOffset(of: numericCast(address)) else {
2325
return nil
@@ -47,7 +49,9 @@ extension PrebuiltLoaderSet {
4749

4850
public func loaders(in cache: DyldCacheLoaded) -> [PrebuiltLoader]? {
4951
// swiftlint:disable:previous unused_parameter
50-
guard isLatestVersion else { return nil }
52+
if let version, version.isPre1165_3 {
53+
return nil
54+
}
5155

5256
guard let basePointer = UnsafeRawPointer(bitPattern: address) else {
5357
return nil
@@ -129,8 +133,8 @@ extension PrebuiltLoaderSet {
129133
public func dyldCacheUUID(in cache: DyldCache) -> UUID? {
130134
guard layout.dyldCacheUUIDOffset != 0,
131135
let offset = cache.fileOffset(
132-
of: numericCast(address) + numericCast(layout.dyldCacheUUIDOffset)
133-
) else {
136+
of: numericCast(address) + numericCast(layout.dyldCacheUUIDOffset)
137+
) else {
134138
return nil
135139
}
136140
let data: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) = cache.fileHandle.read(offset: offset)
@@ -228,9 +232,11 @@ extension PrebuiltLoaderSet {
228232
case v0x9a661060 = 0x9a661060
229233
/// from dyld-1231.3
230234
case v0x173a676e = 0x173a676e
235+
/// from dyld-1241.17
236+
case v0x18cf6421 = 0x18cf6421
231237

232238
public var isLatest: Bool {
233-
self == .v0x173a676e
239+
self == .v0x18cf6421
234240
}
235241

236242
public var isPre1165_3: Bool {

0 commit comments

Comments
 (0)