cterminologyaslr

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


When reading https://en.wikipedia.org/wiki/Address_space_layout_randomization, I encountered a term:

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.

What does main executable binary mean here? Is it just a tu/source file that contains the main function?


Solution

  • It means the output of the linker when you build your executable, the so-called a.out file in the *nix world. The compiler creates object files and the linker resolves all the dependencies into an a.out file. Some of those dependencies will be external (dynamic link libraries).

    The main executable will be the file that the os (possibly the linker) loads initially when you execute it. Subsequent loads would be the dynamic link libraries that are external dependencies created during the build process.