Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions macholibre/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,16 @@
2147483648 + 100: 'POWERPC_970 (LIB64)'
}
}

tools = {
1: 'CLANG',
2: 'SWIFT',
3: 'LD'
}

platforms = {
1: 'MACOS',
2: 'IOS',
3: 'TVOS',
4: 'WATCHOS'
}
22 changes: 22 additions & 0 deletions macholibre/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,26 @@ def parse_main(self, cmd, cmd_size):

return output

def parse_build_version(self, cmd, cmd_size):
"""Parse build version load command."""

output = {
'cmd': cmd,
'cmd_size': cmd_size,
'platform': dictionary.platforms[self.get_int()],
'minos': self.get_int(),
'sdk': self.get_int(),
'tools': []
}

for _ in range(self.get_int()):
output['tools'].append({
'tool': dictionary.tools[self.get_int()],
'version': self.get_int()
})

return output

def parse_lcs(self, offset, size, nlcs, slcs):
"""Determine which load commands are present and parse each one
accordingly. Return as a list.
Expand Down Expand Up @@ -855,6 +875,8 @@ def parse_lcs(self, offset, size, nlcs, slcs):
self.__macho['lcs'].append(self.parse_rpath(cmd, cmd_size))
elif cmd == 'MAIN':
self.__macho['lcs'].append(self.parse_main(cmd, cmd_size))
elif cmd == 'BUILD_VERSION':
self.__macho['lcs'].append(self.parse_build_version(cmd, cmd_size))

def parse_syms(self, offset, size, lc_symtab):
"""Parse symbol and string tables.
Expand Down