How Program linking is possible in loaders?


The Goal of program linking is to resolve the problems with external references (EXTREF) and external definitions (EXTDEF) from different control sections.
EXTDEF (external definition) - The EXTDEF statement in a control section names symbols, called external symbols, that are defined in this (present) control section and may be used by other sections.

ex: EXTDEF BUFFER, BUFFEND, LENGTH EXTDEF LISTA, ENDA EXTREF (external reference) - The EXTREF statement names symbols used in this (present) control section and are defined elsewhere. ex: EXTREF RDREC, WRREC EXTREF LISTB, ENDB, LISTC, ENDC

How to implement EXTDEF and EXTREF
The assembler must include information in the object program that will cause the loader to insert proper values where they are required – in the form of Define record (D) and, Refer record(R).
Define record
The format of the Define record (D) along with examples is as shown here. Col. 1 D Col. 2-7 Name of external symbol defined in this control section Col. 8-13 Relative address within this control section (hexadecimal) Col.14-73 Repeat information in Col. 2-13 for other external symbols


Share to whatsapp

More Questions from System Software and Compiler Design Module 2

Input Buffering in Compiler Design
View
Difference Between Linking Loader vs Linkage Editor
View
What is dynamic linking? explain the process of loading and calling a subroutine using dynamic linking
View
Roles of the Lexical analyzer
View
Explain Lexical analysis with a block diagram
View
How Program linking is possible in loaders?
View
What is Lexical Analysis?
(or)
Lexical Analysis in Compiler Design with Example
View