Runtime Linker
When creating a dynamic object that initiates dynamic linking, the link-editor adds a program header element of type PT_INTERP
to an executable file. This element instructing the system to invoke the runtime linker as the program interpreter.
exec
(2) and the runtime linker cooperate to create the process image for the program.
The link-editor constructs various data for dynamic objects that assist the runtime linker. These data reside in loadable segments, thus making the data available during execution. These segments include.
-
A
.dynamic
section with typeSHT_DYNAMIC
that holds various data. The structure residing at the beginning of the section holds the addresses of other dynamic linking information. -
The
.got
and.plt
sections with typeSHT_PROGBITS
that hold two separate tables: the global offset table and the procedure linkage table. Sections that follow, explain how the runtime linker uses and changes the tables to create memory images for object files. -
The
.hash
section with typeSHT_HASH
that holds a symbol hash table.
Shared objects can occupy virtual memory addresses that are different from the addresses that are recorded in the file's program header table. The runtime linker relocates the memory image, updating absolute addresses before the application gains control.