填充的要点是什么?

发布于 2024-10-09 08:42:24 字数 200 浏览 0 评论 0原文

特别是,我正在读取 OS X 上 Intel 32 的 Mach-O 二进制文件格式。在 FAT 标头之后,在第一个存档的偏移量之前有一大堆填充。所有这些填充的意义是什么?

更具体地说,FAT 标头和第一个存档(特别是 mach_header)之间有超过 4000 字节的填充。为什么要包含所有这些额外的字节?! OS X 喜欢在所有通用二进制文件中添加 4 KB 吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯了 2024-10-16 08:42:24

我的猜测是,添加它是为了确保下一个段从 4096 字节边界开始,即 x86 上虚拟内存页面的大小。 x86(和 PCC)上的虚拟内存以块的形式分配,块的大小是 4kB 的倍数。保持光盘格式与内存页面大小兼容使得按需加载更容易实现。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文