ILD

ELF与a.out
作者:Herbert Yuan 邮箱:yuanjp89@163.com
发布时间:2017-5-30 站点:Inside Linux Development

Linux之前使用a.out格式,后来直到现在使用elf格式。为什么转换,历史原因是什么呢?下面是一些国外的评论。

Deepankar Dubey:

ELF (Executable and Linking Format) is a binary format originally developed by USL (UNIX System Laboratories) and currently used in Solaris and System V Release 4. Because of its increased flexibility over the older a.out format that Linux previously used, the GCC and C library developers decided to move to using ELF as the Linux standard binary format also.

Pascal Cuoq:

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.

参考资料

http://tech.queryhome.com/20038/what-is-the-difference-between-elf-and-a-out

https://stackoverflow.com/questions/2352378/a-out-replaced-by-elf-file-format

Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.