0
3.2kviews
Explain Design of Dynamic Linking Loader along with example.

Mumbai University > Computer Engineering > Sem6 > System Programming and Compiler Construction

Marks: 10M

Year: Dec 2015

1 Answer
0
6views

Loader:

  • 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:

    • Allocation:

      Allocates the space in the memory where the object program would be loaded for Execution.

    • Linking: It links two or more object codes and provides the information needed to allow references between them.

    • Loading:

      It brings the object program into the memory for execution.

enter image description here

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.

enter image description here

  • Length of segment.

    1. A list of all symbols in the segment that may be referenced by other segments.

    2. List of all symbols not defined in the segment but referenced in the segment.

    3. Information where the address constant are loaded in the segment.

Format of Databases:

The assembler provides 4 types of record in the object file as follows:

1. 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.

2. Text Cards (TXT)

  • Text card record control the actual object code translated version of the source program.

3. 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.

4. END CARD:

  • The END card records indicates the end of the object File and specifies the start address for Execution.

enter image description here

enter image description here

  • ESD

    IT consist of three types of definition

    • SD- Segment Definition

    • LD – Local Definition

    • ER – External Reference

Symbol Type Id RA Length
PG1 SD 1 0 52
A LD 1 20 -
B LD 1 24 -
PG2 ER 2 - -
C ER 3 - -
  • Relocating and Linking directory (RLD)

    • It includes different operations performed on it.
    • Flag is important in this table
Esd id Symbol Flag R.A
1 A + 40
1 B - 44
3 C - 48

Note:

  • 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.

5. END

  • Specifies the END of the program.
  • And total address is generated by PLA + SLength.
Please log in to add an answer.