a.out 替换为 ELF 文件格式?

发布于 2024-08-23 05:51:19 字数 170 浏览 5 评论 0原文

我有几个问题:

  • 为什么a.outELF取代?
  • a.out 格式的主要缺陷是什么导致了 ELF 文件格式的兴起?
  • 早期的核心转储基于 a.out,但现在它们基于 ELF。 ELF 提供哪些优势?

I have a few questions:

  • Why was a.out replaced by ELF?
  • What were the major flaws in the a.out format that led to the raise of ELF file format?
  • Earlier core dumps were based on a.out, but now they are based on ELF. What are the various advantages provided by ELF?

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

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

发布评论

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

评论(2

可是我不能没有你 2024-08-30 05:51:19

a.out 格式强制共享库占据内存中的固定位置。如果您想分发 a.out 共享库,则必须注册其地址空间。这对性能有好处,但根本无法扩展。亲自看看这有多棘手 (linuxjournal)。

相比之下,在 ELF 中,共享库可以加载到内存中的任何位置,甚至对于同一台计算机上运行的不同应用程序来说,共享库可能位于不同的地址(代码仍然有效地加载到物理内存中的一个位置)!为了实现这一点,在IA-32架构中,必须牺牲一个寄存器(%ebx)。 更全面的参考显示共享库在 ELF 中变得更加复杂,但那是编译器 -一侧的复杂性,与程序员一侧相反。

The a.out format forced shared libraries to occupy a fixed place in memory. If you wanted to distribute an a.out shared library, you had to register its address space. This was good for performance but it didn't scale at all. See for yourself how tricky it was (linuxjournal).

By contrast, in ELF, shared libraries can be loaded anywhere in memory, and can even appear to be at different addresses to different applications running on the same computer (with the code still effectively loaded in only one place in physical memory)! In order to achieve this, in the IA-32 architecture, a register (%ebx) has to be sacrificed. A more comprehensive reference showing that shared libraries got more complicated in ELF, but that was compiler-side complexity, as opposed to programmer-side.

娇俏 2024-08-30 05:51:19

我记得,a.out 格式最初的问题之一是它只支持三个部分:文本、数据和 bss。 ELF 允许任意数量(或至少更多)。 a.out 标头格式非常简单,类似于:

word <magic>
word <text size>
word <data size>
word <bss size>

相比之下,ELF 格式具有节标头,包含名称、大小等。

拥有更多节可以使用标准节,但也为我们提供了 const 节、构造函数节,如果我们需要的话,甚至可以为每个函数分配一个部分。

As I recall, one of the original problems with a.out format is that it only supported three sections: text, data, and bss. ELF allows any number (or at least many more). The a.out header format was very simple, something like:

word <magic>
word <text size>
word <data size>
word <bss size>

The ELF format, in contrast, has section headers, with names, sizes, etc.

Having more sections allows for the standard sections, but also gives us const sections, constructor sections, and even one section per function, if we want it.

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