Content deleted Content added
→Overview: improve text |
→Overview: add comma |
||
Line 22:
Linkers can take objects from a collection called a [[library (computing)|library]] or [[runtime library]]. Most linkers do not include all the object files in a [[static library]] in the output executable; they include only those object files from the library that are referenced by other object files or libraries directly or indirectly. But for a [[shared libraries|shared library]], the entire library has to be loaded during runtime as it is not known which functions or methods will be called during runtime. Library linking may thus be an iterative process, with some referenced modules requiring additional modules to be linked, and so on. Libraries exist for diverse purposes, and one or more system libraries are usually linked in by default.
The linker also takes care of arranging the objects in a program's [[address space]]. This may involve ''relocating'' code that assumes a specific [[base address]] into another base. Since a compiler seldom knows where an object will reside, it often assumes a fixed base ___location (for example, [[zero base|zero]]). Relocating machine code may involve re-targeting absolute jumps, loads, and stores.
The executable output by the linker may need another relocation pass when it is finally loaded into memory (just before execution). This pass is usually omitted on [[computer hardware|hardware]] offering [[virtual memory]]: every program is put into its own address space, so there is no conflict even if all programs load at the same base address. This pass may also be omitted if the executable is a [[position independent]] executable.
|