Download presentation
Presentation is loading. Please wait.
Published byJeffrey Lloyd Modified over 5 years ago
1
System Programming Chapter-4 Loaders and Linkers
2
3.0 Introduction The succeeding processes should be conducted after translation of source program Loading : brings the object program into memory for execution Relocation : modifies the object program so that it can be loaded at an address different from the original location Linking : combines two or more separate object programs and supplies the information needed to allow references between them
3
3.0 Introduction-cont’d The tasks of a loader performed Loading
Relocation (for most loaders) Linking (for most loader) : generally performed by a linker or a linkage editor
4
3.1 Basic Loader Functions
Brings an object program into memory and starts its execution Introduce an absolute loader – a loader might be found in a simple (e.g. SIC) machine that uses the absolute addressing scheme Linking loader – also support relocation and linking Linkage editor – perform linking before loading
5
3.1.1 Design of an Absolute Loader
Object program H COPY A T E … T 00101E 15 0C C F46 …. .... T C E Fig. 3.1 (a)
6
3.1.1 Design of an Absolute Loader-cont’d
Memory Address Memory Contents 0FF0 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx C A 0C D0C10 C …… C C xxxx xxxxxxx Fig. 3.1 (b)
7
3.1.1 Design of an Absolute Loader-cont’d
Algorithm for an absolute loader Begin read Header record verify program name and length read first Text record while record type ‘E’ do begin { if object code is in character form, convert into internal representation } move object code to specified location in memory read next object program record end jump to address specified in End record end
8
3.1.2 A Simple Bootstrap Loader
The source code for SIC/XE bootstrap loader BOOT START This bootstrap reads object code from device F1 and enters it into memory starting address 80 (Hex.). After all of the code has been seen entered into memory, the bootstrap executes a jump to address 80 to begin execution. Register X contains the next address to be loaded CLEAR A LDX # initialize register X to hex 80 LOOP JSUB GETC read Hex. digit RMO A, S save in register S SHIFTL S, move to high-order 4 bits JSUB GETC get next Hex. digit
9
3.1.2 A Simple Bootstrap Loader-cont’d
The source code for SIC/XE bootstrap loader ADDR S, A combine digits to form 1 byte STCH , X store at address in register X TIXR X, X add 1 to memory address J LOOP . Subroutine to read one char from input device and convert it from ASCII code to Hex. Digit value. The converted digit value is returned in register A. when end-of-file is read, control is transferred to the starting address (Hex.80) . GETC TD INPUT test input device JEQ GETC
10
3.1.2 A Simple Bootstrap Loader-cont’d
The source code for SIC/XE bootstrap loader GETC RD INPUT read character COMP # if end-of-file (Hex. 04) jump JEQ to starting address COMP # compare to Hex. 30 (‘0’) JLT GETC skip char less than ‘0’ SUB # subtract Hex. 30 from ASCII COMP # if result is less than 10, conversion JLT RETURN is complete, otherwise subtract SUB # more (‘A’ through ‘F’ RETURN RSUB return to caller INPUT BYTE X’F1’ END
11
3.2 Machine-Dependent Loader Features
Disadvantages of absolute loader One of the most obvious is the need for the programmer to specify the actual address at which it will be loaded into memory Writing absolute programs also makes it difficult to use subroutine libraries efficiently. This could not be done effectively if all of the subroutines had pre-assigned absolute addresses. Actually, linking usually involves relocation
12
3.2.1 Relocation Two methods for specifying relocation as part of the object program The first method: A Modification record (The format is given in Section ) is used to describe each part of the object code that must be changed when the program is relocated Fig 3.4 shows a SIC/XE program we use to illustrate this first method of specifying relocation
13
3.2.1 Relocation-cont’d SIC/XE Assembly Program (Fig. 3.4/Fig. 2.6)
Line Loc Source statement Object code 5 0000 COPY START 10 FIRST STL RETADR 17202D 12 0003 LDB #LENGTH 69202D 13 BASE LENGTH 15 0006 CLOOP +JSUB RDREC 4B101036 20 000A LDA 032026 25 000D COMP #0 290000 30 0010 JEQ ENDFIL 332007 35 0013 WRREC 4B10105D
14
3.2.1 Relocation-cont’d SIC/XE Assembly Program (Fig. 3.4) Line Loc
Source statement Object code 40 0017 J CLOOP 3F2FEC 45 001A ENDFIL LDA EOF 032010 50 001D STA BUFFER 0F2016
15
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 55 0020 LDA #3 010003 60 0023 STA LENGTH 0F200D 65 0026 +JSUB WRREC 4B10105D 70 002A J @RETADR 3E2003 80 002D EOF BYTE C’EOF’ 454F46 95 0030 RETADR RESW 1 100 0033
16
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 105 0036 BUFFER RESB 4096 110 ~ 120 . . SUBROUTINE TO READ RECORD INTO BUFFER 125 1036 RDREC CLEAR X B410 130 1038 A B400 132 103A S B440 133 103C +LDT #4096 135 1040 RLOOP TD INPUT E32019
17
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 140 1043 JEQ RLOOP 332FFA 145 1046 RD INPUT DB2013 150 1049 COMPR A,S A004
18
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 155 104B JEQ EXIT 332008 160 104E STCH BUFFER, X 57C003 165 1051 TIXR T B850 170 1053 JLT RLOOP 3B2FEA 175 1056 STX LENGTH 134000 180 1059 RSUB 4F0000 185 105C INPUT BYTE X’F1’ F1 195 ~ 205 . . SUBROUTINE TO WRITE RECORD FROM BUFFER
19
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 210 105D WRREC CLEAR X B410 212 105F LDT LENGTH 774000 215 1062 WLOOP TD OUTPUT E32011 220 1065 JEQ 332FFA 225 1068 LDCH BUFFER, X 53C003 230 106B WD DF2008 235 106E TIXR T B850 240 1070 JLT 3B2FEF 245 1073 RSUB 4F0000
20
3.2.1 Relocation-cont’d Fig. 3.4 Program-cont’d Line Loc
Source statement Object code 250 1076 OUTPUT BYTE X’05’ 05 255 END FIRST
21
3.2.1 Relocation-cont’d Relocation example with modification records use H COPY T D 17202D 69202D …. … M COPY M COPY M COPY For format-4 instructions only Fig. 3.5 object program with relocation by modification records of Fig. 3.4
22
3.2.1 Relocation-cont’d Standard SIC relocatable program (Fig. 3.6)
Line Loc Source statement Object code 5 0000 COPY START 10 FIRST STL RETADR 140033 15 0003 CLOOP JSUB RDREC 481039 20 0006 LDA LENGTH 000036 25 0009 COMP ZERO 280030 30 000C JEQ ENDFIL 300015 35 000F WRREC 481061
23
3.2.1 Relocation-cont’d Standard SIC relocatable program (Fig. 3.6)
Line Loc Source statement Object code 40 0012 J CLOOP 3C0003 45 0015 ENDFIL LDA EOF 00002A 50 0018 STA BUFFER 0C0039
24
3.2.1 Relocation-cont’d Fig. 3.6 Program-cont’d Line Loc
Source statement Object code 55 001B LDA THREE 00002D 60 001E STA LENGTH 0C0036 65 0021 JSUB WRREC 481061 70 0024 LDL RETADR 080033 75 0027 RSUB 4C0000 80 002A EOF BYTE C’EOF’ 454F46 85 002D WORD 3 000003 90 0030 ZERO 000000 95 0033 RESW 1 100 0036
25
3.2.1 Relocation-cont’d Fig. 3.6 Program-cont’d Line Loc
Source statement Object code 105 0039 BUFFER RESB 4096 110 ~ 120 . . SUBROUTINE TO READ RECORD INTO BUFFER 125 1039 RDREC LDX ZERO 040030 130 103C LDA 000030 135 103F RLOOP TD INPUT E0105D
26
3.2.1 Relocation-cont’d Fig. 3.6 Program-cont’d Line Loc
Source statement Object code 140 1042 JEQ RLOOP 30103F 145 1045 RD INPUT D8105D 150 1048 COMPR ZERO 280030
27
3.2.1 Relocation-cont’d Fig. 3.6 Program-cont’d Line Loc
Source statement Object code 155 104B JEQ EXIT 301057 160 104E STCH BUFFER, X 548039 165 1051 TIXR MAXLEN 2C105E 170 1054 JLT RLOOP 38103F 175 1057 STX LENGTH 100036 180 105A RSUB 4C0000 185 105D INPUT BYTE X’F1’ F1 190 105E WORD 4096 001000 195 ~ 205 . . SUBROUTINE TO WRITE RECORD FROM BUFFER
28
3.2.1 Relocation-cont’d Fig. 3.6 Program-cont’d Line Loc
Source statement Object code 210 1061 WRREC LDX ZERO 040030 215 1064 WLOOP TD OUTPUT E01079 220 1067 JEQ 301064 225 106A LDCH BUFFER, X 508039 230 106D WD DC1079 235 1070 TIX LENGTH 2C0036 240 1073 JLT LOOP 381064 245 1076 RSUB 4C0000 250 1079 BYTE X’05’ 05 255 END FIRST
29
3.2.1 Relocation-cont’d Comments for Fig. 3.6
The standard SIC does not use relative address, the addresses in all instructions must be modified with 31 modification records (too large) A different technique (is well suitable for machine that uses direct addressing and has a fixed instruction format) A relocation bit associated with each word of object code All bits are gathered together into a bit mask following the length indicator in each Text record
30
3.2.1 Relocation-cont’d H COPY A T E FFC ….. T 00001E 15 E00 0C C F …. T E FFC …. T A C0000 F T FE E01079 ….. E Fig. 3.7 Relocation bit mask If the relocation bit is set to 1, the program’s starting address is to be added when the program is relocated, a bit value of 0 indicates that no modification is necessary
31
3.2.2 Program Linking Control section review
Could be assembled together or assembled independently Appear as separate segments of object code after assembly EXTDEF (external definition) & EXTREF (external reference)
32
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0000 PROGA START EXTDEF LISTA, ENDA EXTREF LISTB,ENDB,LISTC,ENDC …. 0020 REF1 LDA LISTA 03201D 0023 REF2 +LDT LISTB+4 0027 REF3 LDX #ENDA-LISTA 050014 0040 EQU *
33
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0054 ENDA EQU * REF4 WORD ENDA-LISTA+LISTC 000014 0057 REF5 ENDC-LISTC-10 FFFFF6 005A REF6 ENDC-LISTC+LISTA-1 00003F 005D REF7 ENDA-LISTA-(ENDB-LISTB) 0060 REF8 LISTB-LISTA FFFFC0 END REF1
34
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0000 PROGB START EXTDEF LISTB, ENDB EXTREF LISTA,ENDA,LISTC,ENDC …. 0036 REF1 +LDA LISTA 003A REF2 LDT LISTB+4 772027 003D REF3 +LDX #ENDA-LISTA 0060 LISTB EQU *
35
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0070 ENDB EQU * REF4 WORD ENDA-LISTA+LISTC 000000 0073 REF5 ENDC-LISTC-10 FFFFF6 0076 REF6 ENDC-LISTC+LISTA-1 FFFFFF 0079 REF7 ENDA-LISTA-(ENDB-LISTB) FFFFF0 007C REF8 LISTB-LISTA 000060 END REF1
36
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0000 PROGC START EXTDEF LISTC, ENDC EXTREF LISTA,ENDA,LISTB,ENDB …. 0018 REF1 +LDA LISTA 001C REF2 +LDT LISTB+4 0020 REF3 +LDX #ENDA-LISTA 0030 LISTC EQU *
37
3.2.2 Program Linking-cont’d
Fig.3.8 Loc Source statement Object code 0042 ENDC EQU * REF4 WORD ENDA-LISTA+LISTC 000030 0045 REF5 ENDC-LISTC-10 000008 0048 REF6 ENDC-LISTC+LISTA-1 000011 004B REF7 ENDA-LISTA-(ENDB-LISTB) 000000 004E REF8 LISTB-LISTA END REF1
38
3.2.2 Program Linking-cont’d
Comments for Fig.3.8 Consider the reference marked REF1 For program PROGA, no modification is necessary (program-counter relative instruction) For program PROGB, the same operand refers to an external symbol, an extended-format instruction is necessary (initially set address to 00000). But a modification record is needed to instruct the loader to add the value of the symbol LISTA to this address The same way is handled for program PROGC Reference REF2 is processed in a similar manner
39
3.2.2 Program Linking-cont’d
Comments for Fig.3.8 Consider the reference marked REF3 In PROGA, the assembler has all of information necessary to compute this immediate value In PROGB and PROGC, the values of the labels are unknown, so the initial value of the address field is set to 00000, and two modification records in object program are necessary for relocation update Consider the reference marked REF4 In PROGA, the assembler can evaluate all of the expression except for the value of LISTC, this results in an initial value of and one modification record
40
3.2.2 Program Linking-cont’d
Comments for Fig.3.8 In PROGB, no terms can be evaluated by the assembler, the object code contains an initial value of and three modification records In PROGC, the assembler can supply the value of LISTC (but not the actual address, the actual address is not known until the program is loaded), modification records instruct the loader to add the beginning address of the program PROGC, to add the value of ENDA, and to subtract the value of LISTA
41
3.2.2 Program Linking-cont’d
Object programs corresponding to Fig.3.8 HPROGA DLISTA ENDA RLISTB ENDB LISTC ENDC … T A03201D … T F000014FFFFF6…. M… M LISTC M ENDC … Fig.3.9
42
3.2.2 Program Linking-cont’d
Object programs corresponding to Fig.3.8 HPROGB F DLISTB ENDB RLISTA ENDA LISTC ENDC … T B … T F000000FFFFF6…. M… M ENDA M LISTA M LISTC M ENDC … Fig.3.9
43
3.2.2 Program Linking-cont’d
Object programs corresponding to Fig.3.8 HPROGC DLISTC ENDC RLISTA ENDA LISTB ENDB … T C … T F …. M… M ENDA M LISTA M PROGC M LISTA … Fig.3.9
44
3.2.2 Program Linking-cont’d
Memory contents from Fig.3.8 after linking and loading D C … … ………… … ………… ………… A ………… 40D0 ……… E …... 40F0 …………. ………… … C …… ………… … Fig (a) Address Contents PROGB PROGC PROGA
45
3.2.2 Program Linking-cont’d
Relocation and linking operations performed on REF4 from PROGA (Fig.3.10(b)) PROGA Memory contents HPROGA.. .. T F … M LISTC … …. … (REF4) ( =4126) + (REF4) PROGC + (Actual address of LISTC = E2) 4112 HPROGC DLISTC … Load addresses PROGA PROGB PROGC E2
46
3.2.3 Algorithm and Data Structures for a Linking Loader
The input to a linking loader consists of a set of object programs (i.e. control sections) that are to be linked together It is possible for a control section to make an external reference to a symbol whose definition does not appear until later in this input stream – so thus a two-pass linking loader is required Pass-1 : assigns addresses to all external symbols Pass-2 : perform the actual loading, relocation, and linking
47
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
The main data structure needed for linking loader is an external symbol table ESTAB (analogous to SYMBOL, contains the name and address of each external symbol) Two other important variables are PRGOADDR (program load address) and CSADDR (control section address); this value is added to all relative addresses within the control section)
48
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
PROGADDR is the beginning address in memory where the linked program is to be loaded. Its value is supplied to the loader by the operating system. CSADDR contains the starting address assigned to the control section currently being scanned by the loader
49
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
Algorithm for pass-1 of a linking loader (Fig. 3.11(a)) Begin get PROGADDR from operating system set CSADDR to PROGADDR {first control section} while not end of input do begin read next input record {Header record for C.S.} set CSLTH to control section length search ESTAB for control section name if found then set error flag {duplicate external symbol} else enter control section name into ESTAB with value
50
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
while record type ≠ ‘E’ do begin read next input record if record type = ‘D’ then for each symbol in the record do begin search ESTAB for symbol name if found then set error flag else enter symbol into ESTAB with value { CSADDR + indicated address) end {for}
51
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
end {while ≠ ‘E’ } add CSLTH to CSADDR {starting address for next C.S.} end {while not EOF} end {Pass 1}
52
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
Algorithm for pass-2 of a linking loader (Fig. 3.11(a)) Begin set CSADDR to PROGADDR {first control section} set EXECADDR to PROGADDR while not end of input do begin read next input record {Header record } set CSLTH to control section length while record type ≠ ‘E’ do begin read next input record
53
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
if record type = ‘T’ then begin {if object code is in char form, convert into internal representation} move object code from record to location (CSADDR + specified address) end {if ‘T’} else if record type -= ‘M’ then begin search ESTAB for modifying symbol name
54
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
if found then add or subtract symbol value at location (CSADDR + specified address) else set error flag {undefined external symbol} end {if ‘M’} end {while ≠ ‘E’ } if an address is specified {in End record} then set EXECADDR to (CSADDR + specified address) add CSLTH to CSADDR end {while not EOF} jump to location given by EXECADDR end {Pass 2}
55
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
Example of external symbol table (ESTAB) Control section Symbol name Address Length PROGA 4000 0063 LISTA 4040 ENDA 4054 PROGB 4063 007F LISTB 40C3 ENDB 40D3 PROGC 40E2 0051 LISTC 4112 ENDC 4124
56
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
During the first pass, the loader is concerned only with Header and Define record types in the control sections. Pass-2 performs the actual loading, relocation, and linking of the program The last step performed by the loader is usually the transferring of control to the loaded program to begin execution.
57
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
In some implementations, the reference number mechanism is used (instead of the symbol name) in modification records for algorithm efficiency improvement. For example HPROGA DLISTA ENDA R02LISTB 03ENDB 04LISTC 05ENDC … T.. .. M M …
58
3.2.3 Algorithm and Data Structures for a Linking Loader-cont’d
The reference number 01 is always assigned to the control section name The main advantage of this reference-number mechanism is that it avoids multiple searches of ESTAB for the same symbol during the loading of a control section. The reference number can be used as an index
59
3.3 Machine-Independent Loader Features
Automatic library search for handling external references Loader options allow the user to specify options that modify the standard processing A special command language is used to specify options. Three methods can be applied
60
3.3.1 Automatic Library Search
In most cases, the subroutines called by the program are automatically fetched from the system library (referred to as automatic library call) A special file structure directory is used to contain the name of each subroutine and a pointer to its address Other libraries may be specified by the programmer to the loader, with control statements or parameters If conflict, the programmer-specified subroutine names override the standard ones
61
3.3.2 Loader Options Typical loader options
Allows the selection of alternative sources of input. For example INCLUDE program-name (library-name) direct the loader to read the designated object program from a library Allows the user to delete external symbol DELETE csect-name instruct the loader to delete the named control section from the set of programs being loaded
62
3.3.2 Loader Options-cont’d
Change external references within the programs being loaded and linked CHANGE name1, name2 Cause the name1 to be changed to name2 Example INCLUDE READ(UTLIB) INCLUDE WRITE(UTLIB) DELETE RDREC, WRREC CHANGE RDREC, READ CHANGE WRREC, WRITE These commands direct the loader :
63
3.3.2 Loader Options-cont’d
To include control sections read and write from library UTLIB To delete the control sections RDREC and WRREC from the load To cause all external references to symbol RDREC to refer to symbol READ, and references to symbol WRREC to refer to symbol WRITE Allow the user to specify alternative libraries to be searched LIBRARY MYLIB the user-specified libraries (e.g. MYLIB) are normally searched before the standard system libraries
64
3.3.2 Loader Options-cont’d
Allow the user to specify that some external references not be solved in this way NOCALL STDDEV, PLOT, CORREL instruct the loader that these external references are to remain unresolved (can avoid the overhead of loading and linking the unneeded routines)
65
3.4 Loader Design Options Linking loader (as discussed before)
Perform all linking and relocation at load time Linkage editors Perform linking prior to load time Dynamic linking The linking function is performed at execution time
66
3.4.1 Linkage Editors Perform linking and some relocation operations
The linked program (often called a load module or an executable image) is written to a file or library instead of being immediately loaded into memory A simple relocating loader can be used to load the program into memory
67
3.4.1 Linkage Editors-cont’d
Processing of an object program using linking loader Object program Library Linking loader Memory
68
3.4.1 Linkage Editors-cont’d
Processing of an object program using linkage editor Object program Library Linkage editor Linked program Relocating loader Memory
69
3.4.1 Linkage Editors-cont’d
Characteristics with linkage editor and linking loader If a program is to be executed many times without being reassembled, the use of linkage editor is preferred (can reduce the overheads associated with resolution of external references and library searching) A linking loader searches libraries and resolves external references every time the program is executed
70
3.4.1 Linkage Editors-cont’d
A linkage editor can easily accomplish the replacement of new subroutines by using the command language, for example INCLUDE PLANNER (PROGLIB) DELETE PROJECT INCLUDE PROJECT (NEWLIB) REPLACE PLANNER (PROGLIB) A Linkage editor can also be used to build packages of subroutines or other control sections that are used together, for example
71
3.4.1 Linkage Editors-cont’d
INCLUDE READR(FTNLIB) INCLUDE WRITER(FTNLIB) INCLUDE BLOCK(FTNLIB) INCLUDE DEBLOCK(FTNLIB) INCLUDE ENCODE(FTNLIB) INCLUDE DECODE(FTNLIB) … SAVE FTNIO(SUBLIB) The linked module named FTNIO which contains the subroutines named as READR, WRITER, BLOCK, …, and so on, will be saved into the library SUBLIB
72
3.4.1 Linkage Editors-cont’d
A linkage editor often allow the user to specify that external references are not to be solved by automatic library search (NOCALL command. This means that this task can be postponed to the execution time) Linkage editors tend to offer more flexibility and control, with a increase in complexity and overhead, compared to the linking loader
73
3.4.2 Dynamic Linking A scheme that postpones the linking function until execution time (a subroutine is loaded and linked to the rest of program when it is first called) Also called dynamic loading or load on call
74
3.4.2 Dynamic Linking-cont’d
The advantages of dynamic linking Allow several executing programs to share one copy of a subroutine or library (instead of linking a separate copy into each object program: linkage editor) In an object-oriented system, dynamic linking is often used for references to software objects : Allows the implementation of the object and its method to be determined at the program execution time (i.e. object to be shared by several programs)
75
3.4.2 Dynamic Linking-cont’d
Dynamic linking provides the ability to load the routines only when they are needed, so thus it can result in substantial savings of time and memory space Dynamic linking can avoid the necessity of loading the entire library for each execution (allow its user to interactively call any of the subroutines)
76
3.4.2 Dynamic Linking-cont’d
A loading and linking method used in dynamic linking Step-1: the program makes a load-and-call service request to the Operating System Dynamic loader (a part of the O.S) User program Load–and-call service request: ERRHANDLE
77
3.4.2 Dynamic Linking-cont’d
Step-2: the O.S examines its internal tables to determine whether or not the routine is already loaded. If necessary, the routine is loaded from the specified library Dynamic loader User program ERRHANDLE Library
78
3.4.2 Dynamic Linking-cont’d
Step-3: after the subroutine is loaded, the control is passed from the O.S to the subroutine Dynamic loader User program ERRHANDLE
79
3.4.2 Dynamic Linking-cont’d
Step-4: when the called routine completes its processing, the control is returned to the user program, by passing through the O.S Dynamic loader User program ERRHANDLE
80
3.4.2 Dynamic Linking-cont’d
Step-5: after the subroutine is completed, the allocated memory may not be released immediately. It is desirable to retain the routine in memory for later use or reclaimed by the O.S while memory space is not enough Dynamic loader User program ERRHANDLE Load–and-call service request: ERRHANDLE
81
3.4.3 Bootstrap Loader Solutions
Given an idle computer with no program in memory, how do we get things started? Solutions On some computers, an absolute loader program is permanently resident in a read-only memory (ROM). When some hardware signal occurs, the machine begins to execute this ROM program. This is referred to as a bootstrap loader.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.