From 202ab4a757d6f2a5790f4c1a5871ed9972526294 Mon Sep 17 00:00:00 2001 From: blacktop Date: Tue, 8 Oct 2024 19:40:33 -0600 Subject: [PATCH] Update swift.go --- pkg/dyld/swift.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkg/dyld/swift.go b/pkg/dyld/swift.go index b81fc9004..4ef8a1fa8 100644 --- a/pkg/dyld/swift.go +++ b/pkg/dyld/swift.go @@ -15,12 +15,16 @@ import ( iswift "github.com/blacktop/ipsw/internal/swift" ) +const MAX_PRESPECIALIZED_METADATA_TABLES = 8 + type SwiftOptimizationHeader struct { - Version uint32 - Padding uint32 - TypeConformanceHashTableCacheOffset uint64 - MetadataConformanceHashTableCacheOffset uint64 - ForeignTypeConformanceHashTableCacheOffset uint64 + Version uint32 + Padding uint32 + TypeConformanceHashTableCacheOffset uint64 + MetadataConformanceHashTableCacheOffset uint64 + ForeignTypeConformanceHashTableCacheOffset uint64 + PrespecializationDataCacheOffset uint64 + PrespecializedMetadataHashTableCacheOffsets [MAX_PRESPECIALIZED_METADATA_TABLES]uint64 } type SwiftProtocolConformance struct { @@ -223,7 +227,7 @@ func (f *File) getSwiftTypeHashTable() (*SwiftHashTable, error) { return nil, fmt.Errorf("failed to read %T: %v", h, err) } - if h.Version != 1 { + if h.Version > 3 { return nil, fmt.Errorf("unsupported Swift optimization version: %d", h.Version) } @@ -259,7 +263,7 @@ func (f *File) getSwiftMetadataTable() (*SwiftHashTable, error) { return nil, fmt.Errorf("failed to read %T: %v", h, err) } - if h.Version != 1 { + if h.Version > 3 { return nil, fmt.Errorf("unsupported Swift optimization version: %d", h.Version) } @@ -295,7 +299,7 @@ func (f *File) getSwiftForeignTypeHashTable() (*SwiftHashTable, error) { return nil, fmt.Errorf("failed to read %T: %v", h, err) } - if h.Version != 1 { + if h.Version > 3 { return nil, fmt.Errorf("unsupported Swift optimization version: %d", h.Version) }