Add support for Mach-O universal binaries.
If the detected file is a Mach-O fat file, the arch specified to Ropper will be selected from the slice of Mach-O images within the fat file. If no arch is specified, the first slice is used. Closes sashs/filebytes#9.
This commit is contained in:
parent
285a086853
commit
f9be1845a1
|
@ -1 +1 @@
|
||||||
Subproject commit dafdbe6ab642041bfdedd8d09676944e80e13ce2
|
Subproject commit f95a315a8c0082dd6249d7d7a2e948653e6e268a
|
|
@ -98,7 +98,15 @@ class MachO(Loader):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _loadFile(self, fileName, bytes=None):
|
def _loadFile(self, fileName, bytes=None):
|
||||||
return macho.MachO(fileName, bytes)
|
mf = macho.MachO(fileName, bytes)
|
||||||
|
if mf.isFat:
|
||||||
|
if not self._arch:
|
||||||
|
return mf.fatArches[0]
|
||||||
|
for arch in mf.fatArches:
|
||||||
|
if ARCH[arch.machHeader.header.cputype] == self._arch:
|
||||||
|
return arch
|
||||||
|
return mf
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def isSupportedFile(cls, fileName, bytes=None):
|
def isSupportedFile(cls, fileName, bytes=None):
|
||||||
|
|
Loading…
Reference in New Issue