diff --git a/src/p_mach.cpp b/src/p_mach.cpp index a33363f0..352ede77 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -626,6 +626,7 @@ void PackMachBase::pack4(OutputFile *fo, Filter &ft) // append PackHeader memcpy(upxstub, stub_main, sz_stub_main); Mach_header *const mhp = (Mach_header *)upxstub; + mhp->cpusubtype = my_cpusubtype; char *tail = (char *)(1+ mhp); Mach_segment_command *segtxt = 0; // in temp for output Mach_section_command *sectxt = 0; // in temp for output @@ -1633,6 +1634,7 @@ int PackMachBase::canUnpack() || my_filetype !=mhdri.filetype ) return false; + my_cpusubtype = mhdri.cpusubtype; rawmseg = (Mach_segment_command *)new char[(unsigned) mhdri.sizeofcmds]; fi->readx(rawmseg, mhdri.sizeofcmds); @@ -1817,6 +1819,7 @@ bool PackMachBase::canPack() || my_filetype !=mhdri.filetype ) return false; + my_cpusubtype = mhdri.cpusubtype; rawmseg = (Mach_segment_command *)new char[(unsigned) mhdri.sizeofcmds]; fi->readx(rawmseg, mhdri.sizeofcmds); diff --git a/src/p_mach.h b/src/p_mach.h index 701d4681..f112c6ef 100644 --- a/src/p_mach.h +++ b/src/p_mach.h @@ -831,6 +831,7 @@ protected: upx_uint64_t entryVMA; unsigned my_cputype; + unsigned my_cpusubtype; unsigned my_filetype; unsigned my_thread_flavor; unsigned my_thread_state_word_count;