与位置无关的可执行文件:什么是 "main executable binary"?

Position-independent executable: What is "main executable binary"?

在阅读https://en.wikipedia.org/wiki/Address_space_layout_randomization时遇到了一个词:

Position-independent executable (PIE) implements a random base address for the main executable binary and has been in place since 2003. It provides the same address randomness to the main executable as being used for the shared libraries.

这里的 main executable binary 是什么意思?它只是一个包含主要功能的 tu/source 文件吗?

我假设它是具有main()功能的二进制文件,所以严格意义上的程序。

之前是程序加载到特定地址,但是动态库已经加载到不同的地址了,所以我觉得这里的main只是同理,是为了程序二进制文件而不是库二进制文件。

它意味着当你构建你的可执行文件时linker 的输出,即*nix 世界中所谓的a.out 文件。编译器创建目标文件,linker 将所有依赖项解析为一个 a.out 文件。其中一些ose 依赖项将是外部的(动态link 库)。

主要可执行文件将是 os(possibly the linker)在您执行时最初加载的文件。后续加载将是动态 link 库,它们是在构建过程中创建的外部依赖项。