开发者

What is the point of padding?

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 p开发者_开发问答adding?

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜