COP 3402 Systems Programming - PowerPoint PPT Presentation

About This Presentation
Title:

COP 3402 Systems Programming

Description:

... an address different from the location. originally specified ... name and address of each external symbol; and in. which control section the symbol is defined ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 15
Provided by: see66
Learn more at: http://www.cs.ucf.edu
Category:

less

Transcript and Presenter's Notes

Title: COP 3402 Systems Programming


1
COP 3402 Systems Programming
  • Dr. Ali Orooji
  • School of EECSUniversity of Central Florida

2
  • Chapter 3 - LOADERS AND LINKERS
  • object program contains translated instructions
    and
  • data values from the source program, and
    specifies
  • addresses in memory where these items are to be
    loaded

Three Functions
Loading brings the object program into
memory for execution
Relocation modifies the object program
when the program is loaded at an address
different from the location originally
specified
Linking combines two or more separate
object programs
3
Absolute Loader - no relocation - no
linking
Relocation (Program Relocation) two methods
- modification records - bit mask
(relocation bit) (if direct addressing
and fixed instruction format)
4
Linking (Program Linking) Figure 3.8 on pages
136-137 of text PROGA ... REF1 LDA
LISTA REF2 LDT LISTB4 REF3 LDX
ENDA-LISTA ... LISTA EQU
... ENDA EQU REF4
WORD ENDA-LISTALISTC REF5 WORD
ENDC-LISTC-10 REF6 WORD
ENDC-LISTCLISTA-1 REF7 WORD
ENDA-LISTA-(ENDB-LISTB) REF8 WORD
LISTB-LISTA
5
PROGB LISTB EQU ENDB EQU

PROGC LISTC EQU ENDC EQU

6
Linking and Relocating Loader Let's assume
control section 1 has external references to
control section 2. Control section 2 comes after
control section 1 so when loading control
section 1 we don't know the addresses for
variables in control section 2
- two passes
Pass 1 assigns addresses to all external
symbols
Pass 2 performs loading, relocation, and
linking
7
Loader Data Structures
external symbol table (ESTAB - ESTBL) name
and address of each external symbol and in
which control section the symbol is defined
program load address (PROGADDR) beginning
address in memory where the linked program
is to be loaded
control section address (CSADDR) starting
address assigned to the control section
currently being scanned by the loader
starting address of the control section
currently being loaded
8
Loader Logic Pass 1 - Page 143 of text
Pass 2 - Page 144 of text
Figure 3.11(a) Algorithm for Pass 1 of a linking
loader Figure 3.11(b) Algorithm for Pass 2 of a
linking loader
9
Section 3.3 Machine-Independent Loader
Features Automatic Library Search
standard system library other libraries
- put external references in ESTBL - after
processing the primary input to loader
if unresolved external references
search the libraries for the routines
10
Section 3.4 Loader Design Options Linking
(and Relocating) Loaders perform all
linking and relocation at load time Linkage
Editors perform linking prior to load
time Dynamic Linking linking is performed
at execution time Bootstrap Loaders - used
to load the operating system or the loader itself
into memory - used to run
stand-alone programs independent of the
operating system or the system loader
11
Linkage Editors Figure 3.13 on page 153 of text
12
Advantage avoids repeated linking
Disadvantage requires extra writing to disk
13
Dynamic Linking postpones the linking
function until execution time a subroutine
is loaded and linked to the rest of the
program when it is first called Advantage
avoids unnecessary linking Figure 3.14 on
page 157 of text
14
Bootstrap Loaders How do we get the first
program into memory? - operator enters
into memory the object code for an
absolute loader, using switches on the computer
console - have absolute loader
program in a read-only memory (ROM)
when the operator presses "system start"
button, the machine begins to execute
this program - when pressing a button, a
record is read from some device into
memory at a fixed location this record
contains instructions for an absolute loader
Write a Comment
User Comments (0)
About PowerShow.com