• Loader is the system program which is responsible for preparing the object program for execution and initiate the execution.
• The loader does the job of coordinating with the OS to get initial loading address for the .EXE file and load it into the memory.
Function of Loader
• Allocates the space in the memory where the object program would be loaded for Execution.
• It links two or more object codes and provides the information needed to allow references between them.
• It brings the object program into the memory for execution.
Dynamic Linking Loader:
• Dynamic Linking Loader is a general re-locatable loader
• Allowing the programmer multiple procedure segments and multiple data segments and giving programmer complete freedom in referencing data or instruction contained in other segments.
• The assembler must give the loader the following information with each procedure or data segment.
• Dynamic linking defers much of the linking process until a program starts running. It provides a variety of benefits that are hard to get otherwise.
• Dynamically linked shared libraries are easier to create than static linked shared libraries.
• Dynamically linked shared libraries are easier to update than static linked shared libraries.
• The semantics of dynamically linked shared libraries can be much closer to those of unshared libraries.
• Dynamic linking permits a program to load and unload routines at runtime, a facility that can otherwise be very difficult to provide.
Length of segment
- A list of all symbols in the segment that may be referenced by other segments.
- List of all symbols not defined in the segment but referenced in the segment.
- Information where the address constant are loaded in the segment.
Format of Databases:
The assembler provides following types of record in the object file as follows
- External Symbol Dictionary (ESD)
• ESD record combine information about all the symbol that are defined in this program.
• But may be referenced in the program but defined elsewhere.
- Text Cards (TXT)
• Text card record control the actual object code translated version of the source program.
- Relocation and Linkage Directory (RLD):
• The RLD records contains information about location in the program
• Whose contents depend on the address at which the program is placed.
- END CARD:
• The END card records indicates the end of the object File and specifies the start address for Execution.
IT consist of three types of definition
• SD- Segment Definition
• LD – Local Definition
• ER – External Reference
Relocating and Linking directory (RLD)
It includes different operations performed on it.
Flag is important in this table
• Since all the address cannot be resolved in the starting.
• We required two pass Dynamic linking Loader.
• In pass 1 , it performs defining of a segment and local definition
• In pass 2, we work on with the text and RLD.
• Specifies the END of the program. • And total address is generated by PLA + SLength.