Linker and Loader are the utility programs that plays a major role in the execution of a program. A loader is a program that places programs into memory and prepares them for execution. There are three kinds of loading approaches:
- Absolute loading
- Relocatable loading
- Dynamic run-time loading
Absolute loading: This approach loads the executable file of a program into a same main memory location each time.
Relocatable loading: In this approach, the compiler or assembler does not produce actual main memory address. It produces the relative addresses.
Dynamic Run-Time loading: In this approach, the absolute address for a program is generated when an instruction of an executable module is actually executed. It is very flexible, the loadable module/executable module can be loaded into any region of main memory.
Linker or link editor is a computer utility program that takes one or more object files generated by a compiler or an assembler and combines them into a single executable file, library file, or another ‘object’ file. We have two types of linkers.
- Linkage Editor: It is a linker that generates the relocatable, executable module.
- Dynamic Linker: It defers/postpones the linkage of some external modules until the load module/executable module is generated. Here, linking is done during load time or run time.