Linker (computing): Difference between revisions

Content deleted Content added
m Removing protection templates from unprotected page (more info)
m Added more clarification as required. Split the statement into two to correct it.
Line 20:
For most compilers, each object file is the result of compiling one input source code file. When a program comprises multiple object files, the linker combines these files into a unified executable program, resolving the symbols as it goes along.
 
Linkers can take objects from a collection called a ''[[library (computing)|library]]'' or [[runtime library]]. Most linkers do not include theentire wholeobject files from a [[Static_library|static]] library in the output executable; they include only thethose object files{{clarify|date=March 2020}}from a library that are referenced by other object files or libraries directly or indirectly. But for [[Shared_libraries|shared library]], the entire library has to be loaded during runtime as it's not known which methods will be called ruing 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 of absolute jumps, loads and stores.