Korona wrote:
I see. I didn't know GNU LD had such an option, that is quite interesting.
from the gnu ld manual page.
Quote:
-q
--emit-relocs
Leave relocation sections and contents in fully linked executables. Post link analysis and optimization tools may need this information in order to perform correct modifications of executables. This results in larger executables.
This option is currently only supported on ELF platforms.
Quote:
Yes, ELF dynamic linking via GOT and PLT is quite complicated but as a result a) lazy binding is made possible, b) the text segment is read-only, even during relocation and c) as a result of b), the text segment can truly be shared among different processes, even if the base addresses of the shared object inside these processes differ.
PE has a notion of "delayed import" which probably serves the same purpose, but doesn't require PIC.
PE text sections among others are really read only too.
there might be some effort applied to make the same DLL have the same Image Base for different processes' images consuming them. It's easy for "system DLLs", but not impossible for any else. It's a broad area for investigating. But then "real" sharing RO ages are possible for PE images.