How To Write Shared Libraries(4)

1.3 How Is ELF Implemented?

The handling of a statically linked application is very simple. Such an application has a fixed load address which the kernel knows. The load process consists sim- ply of making the binary available in the appropriate ad- dress space of a newly created process and transferring control to the entry point of the application. Everything else was done by the static linker when creating the exe- cutable.
静态链接处理非常简单。
这样的应用有一个kernal可感知的固定地址。
加载进程是一个简单的程序:在适当的地址启动一个进程,并将控制权限转到应用的入口地址。
其他事物静态连接器在链接时完成。

Dynamically linked binaries, in contrast, are not com- plete when they are loaded from disk. It is therefore not possible for the kernel to immediately transfer con- trol to the application. Instead some other helper pro- gram, which obviously has to be complete, is loaded as well. This helper program is the dynamic linker. The task of the dynamic linker is it, to complete the dynamically linked application by loading the DSOs it needs (the de- pendencies) and to perform the relocations. Then finally control can be transferred to the program.
动态链接的程序,从磁盘加载时明显不完整。
因此内核无法立即转换控制权限到应用中。
替代的是一些完整的已加载的辅助程序。
辅助程序是动态链接器。
链接器的任务是:加载需要的动态库,执行重定向操作。
最终转移控制权限到应用中。

This is not the last task for the dynamic linker in most cases, though. ELF allows the relocations associated with a symbol to be delayed until the symbol is needed. This lazy relocation scheme is optional, and optimizations dis- cussed below for relocations performed at startup imme- diately effect the lazy relocations as well. So we ignore in the following everything after the startup is finished.
然而,大部分情况下,这不是动态链接器的最后任务。
ELF允许延迟加载。
延迟加载时一个可选项,后续分析延迟加载对于启动性能的优化。
我们忽略启动完成后的内容。

你可能感兴趣的:(How To Write Shared Libraries(4))