Skip to content

Commit

Permalink
Update swift.go
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Oct 9, 2024
1 parent 3554729 commit 202ab4a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/dyld/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 202ab4a

Please sign in to comment.