@thakis pointed out that mach_header and mach_header_64
actually have the same set of (used) fields, with the 64-bit version
having extra padding. So we can access the fields we need using the
single mach_header type instead of using templates to switch between
the two.
I also spotted a potential issue where hasObjCSection tries to parse a
file w/o checking if it does indeed match the target arch... As such,
I've added a quick magic number check to ensure we don't access invalid
memory during findCommand().
Addresses PR50180.
We should probably memset(buf + sizeof(mac_header), target->headerSize - sizeof(mac_header), 0) here to make sure that the reserved field is set to some deterministic data here. (Or is the output pre-zeroed? Probably not?)