Page 140 - DCAP507_SYSTEM_SOFTWARE
P. 140
System Software
Notes 5. An array, the Local External Symbol Array (LESA), which is utilized to establish a
correspondence among the NAMES, used on ESD and RLD records, and the analogous
external symbol's absolute address.
Global External Symbol Table
The Global External Symbol Table (GEST) is used to amass the external symbols defined by
means of a Segment Definition (SD) or Local Definition (LD) entry on an External Symbol
Dictionary (ESD) record. When these symbols are encountered throughout pass 1, they are
allocated an absolute core address; this address is stored, along with the symbol, in the GEST as
demonstrated.
Task Compare pass 1 databases and pass 2 databases.
9.2.3 Algorithm
The following two flowcharts illustrate an algorithm for a direct linking loader. While most of
the logical processes are involved, these flowcharts are still a generalization of the operations
carried out in a complex loader. Particularly, many special traits, like COMMON segments
library processing dynamic loading dynamic linking are not overtly included.
Pass 1 – Allocate Segments and Define Symbols
The purpose of the first pass is to assign a location to each segment, and thus to define the values
of all external symbol.
Since we wish to minimize the amount of core storage required for the total program, we will
assign each segment the next table location after the preceding segment. It is necessary for the
loader to know where. It can load the first segment. This address the Initial Program Load
Address (IPLA), is normally determined by the operating system. In some systems the
programmer may specify the IPLA; in either case we will assume that the IPLA is a parameter
supplied to the loader. Initially, the Program Load Address (PLA) is set to the Initial Program
Load address IPLA. An object record is then read and a copy written for use by pass 2. The record
can be one of five types, ESD, TXT, RLD, END, or LDT/EOF.
If it is a TXT or RLD record, there is no processing required during pass 1 so the next record is
read. An ESD record is processed in different ways depending upon the type of external symbol,
SD, LD or ER. If a segment definition
ESD record is read, the length field, LENGTH, from the record is temporarily saved in the
variable, SLENGTH . The value, VALUE, to be assigned to this symbol is set to the value of the
PLA. The symbol and its assigned value are then stored in the GEST; if the symbol already
existed in the GEST, there must have been a previous SD or LD ESD with the same name - this is
an error. The symbol and its value are printed as part of the load map. A similar process is used
for LD symbols; the value to be assigned is set to the current PLA plus the relative address,
ADDR, indicated on the ESD record. The ER symbols do not require any processing during pass
1. When an END record is encountered, the program load address is incremented by the length
of the segment and saved in SLENGTH, becoming the PLA for the next segment. When the LDT
or EOF record is finally read, pass 1 is completed and control transfer to pass 2.
134 LOVELY PROFESSIONAL UNIVERSITY