Recently, I'm learning some materials related to Mach-O and noticed the comment
When a slice is greater than 4mb or an offset to a slice is greater than 4mb then the 64-bit fat file format is used.
in 'mach-o/fat.h'
about struct fat_acrh_64
I know we should use the value of fat_header.magic
to decide use fat_arch
or fat_arch_64
to parse the data in a fat file.
But I am confused about the comment, why the limit condition is 4 Mb
and what's the slice/offset
in the comment means?
The comment is wrong and you can find counterexamples in the wild.
This is from an M1 Mac:
As you can see, both size and offset are in excess of 14MB.
A reasonable guess would be that they meant 4GB, which is the limit of what a uint32 can represent.