Question

In particular, I'm reading into the Mach-O binary file format for Intel 32 on OS X. After the FAT header there is a whole bunch of padding before the offset of the first archive. What is the point of all this padding?

To be more specific, there is upwards of 4000 bytes of padding between the FAT header and the first archive (in particular, the mach_header). Why include all these extra bytes?! Is OS X fond of adding 4 KB to all their universal binaries?

Was it helpful?

Solution

My guess is that this is added to make sure that the next segment start at a 4096 byte boundary, the size of a virtual memory page on x86. Virtual memory on x86 (and PCC) is allocated in blocks which is a multiple of 4kB in size. Keeping the disc format compatible with memory page size makes demand loading easier to implement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top