Unit2 MACROPROCESSORS LOADERS AND LINKERS Macro Processor Macro

  • Slides: 88
Download presentation
Unit-2 MACROPROCESSORS, LOADERS AND LINKERS Macro Processor: Macro Definition and call, Macro Expansion, Nested

Unit-2 MACROPROCESSORS, LOADERS AND LINKERS Macro Processor: Macro Definition and call, Macro Expansion, Nested Macro Calls and definition, Advanced Macro Facilities, Design of two-pass Macro Processor. Loaders: Loader Schemes, Compile and Go, General Loader Scheme, Absolute Loader Scheme, Subroutine Linkages, Relocation and linking concepts, Self-relocating programs, Relocating Loaders, Direct Linking Loaders, Overlay Structure. 11/27/2020 1

Unit-1 Loader and Linker A program which accepts object program and prepares them for

Unit-1 Loader and Linker A program which accepts object program and prepares them for execution. 11/27/2020 2

11/27/2020 3

11/27/2020 3

Basic Concept object code, or an object file, is the representation of code that

Basic Concept object code, or an object file, is the representation of code that a compiler or assembler generates by processing a source code file. A linker is typically used to generate an executable file by linking object files together. Object files often also contain data for use by the code at runtime, relocation information, program symbols (names of variables and functions) for linking and/or debugging purposes, and other debugging information. 11/27/2020 4

Basic Concept… In MS-DOS, Windows 95/98 etc object modules have extension. obj and the

Basic Concept… In MS-DOS, Windows 95/98 etc object modules have extension. obj and the executable binary programs have. exe extension. In UNIX, object modules have. o extension and executable programs have no extens 11/27/2020 5

Basic Functions of the Loader ALLOCATION: Allocates space in memory for the programs( calculation

Basic Functions of the Loader ALLOCATION: Allocates space in memory for the programs( calculation program size) RELOCATION: Adjustment of addresses of all address sensitive entities . LINKING: Resolve inter-segment (inter-program) symbolic reference in object program. Linking of object modules with each other. LOADING: Physically place the machine instructions and data into memory and initiate execution. 11/27/2020 6

Loader Source Program Assembler Fig. : Role of loader 11/27/2020 Loader Object program ready

Loader Source Program Assembler Fig. : Role of loader 11/27/2020 Loader Object program ready for execution Memory 7

Loader is utility program which takes object code as input prepares it for execution

Loader is utility program which takes object code as input prepares it for execution and loads the executable code into the memory. Thus loader is actually responsible for initiating the executions process. 11/27/2020 8

 Relocation and linking concepts 11/27/2020 9

Relocation and linking concepts 11/27/2020 9

Linking concepts User defined function and library funtion Example-printf() , scanf() The linking process

Linking concepts User defined function and library funtion Example-printf() , scanf() The linking process makes address of modules known to each other so that transfer of control takes place during execution. Passing of parameter is handled by the linker. Public variable-same address External variable –defined in one module and used in another module. Resolving of addresses of symbolic reference is handled by the linker. 11/27/2020 10

Linking concepts… Linker- 1. Handled the passing of parameter 2. Resolving of address of

Linking concepts… Linker- 1. Handled the passing of parameter 2. Resolving of address of symbolic reference 11/27/2020 11

Relocation concepts It is the process of modifying the addresses used in the address

Relocation concepts It is the process of modifying the addresses used in the address sensitive instructions of a program So, program Can execute correctly from any designated area of memory. Ex. MOVER AREG, X Ex. : -Program A, call function F 1(); Program A and F 1() must be linked with each other. 11/27/2020 12

Relocation concepts Case I: Address assigned to Prog. A and F 1 () when

Relocation concepts Case I: Address assigned to Prog. A and F 1 () when they translated to memory 0 Drawback- a lot of storage area is wasted 100 A 250 Wasted area 400 F 1 500 Fig. : General Loading scheme 11/27/2020 13

Relocation concepts… Case II: These two module cannot co-exist at same storage locations. Main

Relocation concepts… Case II: These two module cannot co-exist at same storage locations. Main Storage 0 100 250 100 200 A F 1 150 151 A F 1 251 Relocated address given by the loader Translation time address Fig. : Relocation to avoid address conflict or storage waste 11/27/2020 14

Relocation concepts… A loader must relocate A and F 1 to avoid address conflict

Relocation concepts… A loader must relocate A and F 1 to avoid address conflict or storage waste. Relocation refers to adjustment of address field not to movement of a program. 11/27/2020 15

Loading Schemes… Various types of loader , based 1. Compile and go loader 2.

Loading Schemes… Various types of loader , based 1. Compile and go loader 2. General loader scheme 3. Absolute loader 4. subroutine linkage 5. Relocating loader 6. Direct linking loader 11/27/2020 on various functionalities 16

Loading Scheme Program modules A and B are loaded in memory after linking. It

Loading Scheme Program modules A and B are loaded in memory after linking. It is ready for execution Object Module A A Loader B Object Module B 11/27/2020 Fig. : General Loading scheme 17

1. Compile and Go Loader Performing the loader function is to have the assembler

1. Compile and Go Loader Performing the loader function is to have the assembler run in one part of memory and place the assembled machine instructions and data, as they are assembled, direcltly into their assigned memory location. Diagram. Also called “assemble and go” 11/27/2020 18

11/27/2020 19

11/27/2020 19

1. Compile and go loader…. Advantages: It is very simple to understand. It is

1. Compile and go loader…. Advantages: It is very simple to understand. It is simple to implement because loader is just an extension to the assembler design. 11/27/2020 20

1. Compile and go loader…. Disadvantages: Portion of the memory is wasted because the

1. Compile and go loader…. Disadvantages: Portion of the memory is wasted because the assembler resides in the memory. It is necessary to assemble every time even though no modifications are being done. Can not handle multiple program segments especially if they are written in different languages (e. g. assembly lang. and FORTRAN or PL/I) Scheme is good for small program not for bigger one Execution time = assemble time + load time 11/27/2020 21

2. General loader scheme Diagram. Loader places m/c instruction in memory. Loader is smaller

2. General loader scheme Diagram. Loader places m/c instruction in memory. Loader is smaller than assembler, so more memory is available to the user. Advantage: 1. reassembly is no longer necessary to run the program. 2. Possible to write subroutine in several different lang. 11/27/2020 22

11/27/2020 23

11/27/2020 23

3. Absolute Loader An Absolute loader is the simplest of all other loaders. It

3. Absolute Loader An Absolute loader is the simplest of all other loaders. It takes the output of Assembler and load into memory without relocation. The output of the assembler can be stored on any machine readable form of storage, But most commonly it is stored on puched cards or magnetic tape, disk, or drum. It loads a binary program in memory for Execution. 11/27/2020 24

3. Absolute Loader…. Binary program is stored in a file that contains: Header records:

3. Absolute Loader…. Binary program is stored in a file that contains: Header records: Contains load Origin , Length of code, load time execution starting address of program. Transfer record: contains entry point of execution 11/27/2020 25

Absolute loader. Advantages: Simple, easy to design and implement Since more core memory is

Absolute loader. Advantages: Simple, easy to design and implement Since more core memory is available the user, as an assembler is not memory at load time. No linking or relocation is efficient. Execution time = load time 11/27/2020 26

Absolute loader. Disadvantages: • Programmer must specify the starting address to the assembler for

Absolute loader. Disadvantages: • Programmer must specify the starting address to the assembler for the program where it should be loaded. • so programmer must know memory management as well as memory status at any time. • It is very difficult to relocate in case of multiple subroutine. 11/27/2020 27

3. Absolute Loader In absolute loader 4 loader function are performed by, Allocation: by

3. Absolute Loader In absolute loader 4 loader function are performed by, Allocation: by programmer Linking: by programmer Relocation: by assembler Loading-by loader • 11/27/2020 28

11/27/2020 29

11/27/2020 29

Problem in Absolute loader…. For Example: Main() and SQRT( ) is loaded at memory

Problem in Absolute loader…. For Example: Main() and SQRT( ) is loaded at memory location 150 - 300 bytes an 450 -500 bytes respectively. If Main() will be modified it might be increase its size of code(may be more than 200 bytes) at that point Main() overlaps the content of SQRT(). Since its MAIN() code size become 150+350=500 Which crosses the load origin of subroutine SQRT() which violets the scheme of absolute loader. So, It is necessary to assign SQRT() to new location in the memory. 11/27/2020 30

Absolute loader…. For that its Start address have to be changed and re- assembling

Absolute loader…. For that its Start address have to be changed and re- assembling is required. Also be necessarily to modify all other subroutines that referred to the address of SQRT(); 11/27/2020 31

Design of an Absolute Loader Algorithm: 1. Begin 2. Read Header record 3. Verify

Design of an Absolute Loader Algorithm: 1. Begin 2. Read Header record 3. Verify program name and length 4. Read first text record 5. While record type <> ‘E’ do 6. Begin 7. { 8. If object code is in character form, convert into internal presentation 9. } 10. Move object code to specified location in memory. 11. Read next object program record. 12. End 13. Jump to address specified in end record 33 11/27/2020 14. end

Subroutine Linkages/Program Linking Loader Subroutine: In given program , it is often needed to

Subroutine Linkages/Program Linking Loader Subroutine: In given program , it is often needed to perform a particular subtask many times on different data values. such a subtask is usually called a subroutine. Subroutine linkage method: The way in which a machine makes it possible to call and return from subroutine is referred to as its Subroutine linkage method 11/27/2020 34

Subroutine Linkage Subroutine Linkage: Instructions There are two forms of the Branch and Link

Subroutine Linkage Subroutine Linkage: Instructions There are two forms of the Branch and Link instruction. BAL Branch and Link BALR Branch and Link, Register. 11/27/2020 35

Subroutine Linkage Calling the subroutine The format of the instruction is BAL Reg, Address

Subroutine Linkage Calling the subroutine The format of the instruction is BAL Reg, Address An example of such an instruction is 8, P 10 PAGE BAL Returning from the subroutine jump to an address contained in the register. The format of the instruction is: BR Reg An example of such an instruction is: BR 8 11/27/2020 36

Example MAIN START EXTRN SUBROUT ------------- L 15, =A(SUBROUT) BALR 14, 15 …. .

Example MAIN START EXTRN SUBROUT ------------- L 15, =A(SUBROUT) BALR 14, 15 …. . END 11/27/2020 SUBROUT START USING *, 15 -------------BR 14 END 37

Relocating Loaders Loader that allow for program relocation are called relocating loader/relative loader. To

Relocating Loaders Loader that allow for program relocation are called relocating loader/relative loader. To avoid possible reassembling of all subroutines when a single subroutine is changed and to perform the tasks of allocation and linking for the programmer the relocating loader is created. 11/27/2020 38

Relocating Loaders…. Example: BINARY SYMBOLIC SUBROUTINE(BSS)loader used in the IBM 7094, IBM 1130, GE

Relocating Loaders…. Example: BINARY SYMBOLIC SUBROUTINE(BSS)loader used in the IBM 7094, IBM 1130, GE 635. The output of a relocating assembler using a BSS scheme is the object program & information about all program it reference. BSS loader scheme is used on computers with a fixed length direct address instruction format. The BSS loader allows many procedure segments but only one data (common)segment. 11/27/2020 39

Relocating Loaders… Transfer Vector: that consists of address containing names of the subroutines referenced

Relocating Loaders… Transfer Vector: that consists of address containing names of the subroutines referenced by the source program. After loading the text and the transfer vector into core, the loader would load each subroutine identified in the transfer vector. Thus the execution of the call SORT statement would result in branch to the first location in the transfer vector The assembler would also provide the loader with additional information, such as the length of the entire program and the length of the transfer vector. 40

Relocating Loaders : Example MAIN =9 =3 END 11/27/2020 START EXTERNAL LOAD BALINK COMPARE

Relocating Loaders : Example MAIN =9 =3 END 11/27/2020 START EXTERNAL LOAD BALINK COMPARE BNE ERR HLT DATA SORT ERR 4 1, =F 9 14, SQRT 1, =F 3 9 3 LC 0 4 8 C 10 14 18 1 C 20 r/s/e 00 00 01 01 00 00 00 SORT ERR LOAD 1, 1 C BALINK 14, 0 COMPARE 1, 20 BNE 4 HLT 0009 0003 41

Relocating Loaders : After Loading Using BSS Scheme Program Length 20 bytes Transfer vector

Relocating Loaders : After Loading Using BSS Scheme Program Length 20 bytes Transfer vector 8 bytes 11/27/2020 0 4 8 C 10 14 18 1 C 20 400 404 408 40 C 410 414 418 41 C 420 BALINK 14, 448 BALINK 14, 526 LOAD 1, 41 C BALINK 14, 400 COMPARE 1, 420 BNE 404 HLT 0009 0003 42

Relocating Loaders : Advantages Relocation bits are used to solve the problem of relocation.

Relocating Loaders : Advantages Relocation bits are used to solve the problem of relocation. Transfer vector is used to solve the problem of linking & Program length info to solve allocation. 11/27/2020 43

Relocating Loaders : Dis. Advantages No suited for loading external data. Transfer vector increase

Relocating Loaders : Dis. Advantages No suited for loading external data. Transfer vector increase the size. Does not facilitate access to data segment that can be shared. 11/27/2020 44

Direct linking loader: It is type of Re-locatable Loader. It is most common type

Direct linking loader: It is type of Re-locatable Loader. It is most common type of loader. It allows the programmer to use multiple procedure segments and multiple data segments. The assembler should give the following information to the loader: 1. The length of the object code segment. 2. A list of all symbols which are not defined in the current segment but can be used in the current segment. 11/27/2020 45

Direct Linking Loader… 3. A list of all symbols which are defined in the

Direct Linking Loader… 3. A list of all symbols which are defined in the current segment but can be referred in the current segment. 4. Information about address constants. 5. Machine code translation of the source program and relative address. To place the object code in the memory there are two situations: 1. Address of the object code could be absolute. 2. The address of object code can be relative. 11/27/2020 46

Direct linking loader: The list of symbols not defined in the current segment but

Direct linking loader: The list of symbols not defined in the current segment but used in the current segment are stored in a data structure called USE table. The lists of symbols defined in the current segment and referred by the other segments are stored in a data structure called DEFINITION table. 11/27/2020 47

Assembler records Assembler generates 4 types of cards in the object desk: ESD: External

Assembler records Assembler generates 4 types of cards in the object desk: ESD: External Symbol Dictionary (ESD) record: TXT: (TXT) records. RLD: Relocation and Linkage Directory (RLD): END : End of object deck 11/27/2020 48

Assembler records…ESD 1. ESD: External Symbol Dictionary (ESD) record: Card contain information about all

Assembler records…ESD 1. ESD: External Symbol Dictionary (ESD) record: Card contain information about all symbol that are defined in this program, but that may reference elsewhere, and all symbol referenced in this program but defined elsewhere. Source object symbol record no. /card no. Type Relative Location Length 1 MAIN SD 0 36 2 RESULT LD 32 - SUM ER - - 3 11/27/2020 49

Assembler records…ESD Type: SD: segment definition: symbol in segment LD: Local definition: symbol is

Assembler records…ESD Type: SD: segment definition: symbol in segment LD: Local definition: symbol is defined in this program but it can be referenced by other program. ER: External symbol: defined in some external program. 11/27/2020 50

Assembler records…TXT 2. TXT: (TEXT) records. Text card contains actual object code. (translated source

Assembler records…TXT 2. TXT: (TEXT) records. Text card contains actual object code. (translated source code). Source object record no. Relative Location 1 0 2 32 3 - 11/27/2020 Object code 51

Assembler records…RLD 3. RLD: Relocation and Linkage Directory (RLD): Card contain information about those

Assembler records…RLD 3. RLD: Relocation and Linkage Directory (RLD): Card contain information about those locations in the program whose content depend on the address at which the program is placed Source object record no. ESD_ID Length(in Byte) Flag + or - + sign denote that something must be added to the constant Relative address 52

Assembler records…END 4. END: card indicate the end of object deck and specifies the

Assembler records…END 4. END: card indicate the end of object deck and specifies the starting address for execution if assembled routine is the main program. 11/27/2020 53

advantages of Direct Linking Allow multiple procedure and data segment. Allow independent translation of

advantages of Direct Linking Allow multiple procedure and data segment. Allow independent translation of the program. Relocation Faclility 11/27/2020 54

Disadvantages of Direct Linking Not suitable in multitasking. It is necessary to allocate, relocate,

Disadvantages of Direct Linking Not suitable in multitasking. It is necessary to allocate, relocate, link, and load all of the subroutines each time in order to execute a program loading process can be extremely time consuming. 11/27/2020 55

Design of Direct Linking Loader Design of direct linking loader is more complicated than

Design of Direct Linking Loader Design of direct linking loader is more complicated than absolute loader. Input to loader is object module and this is divide into 4 section ESD, TXT, RLD, END It requires two passes to complete the linking process Pass I: assigns addresses to all external symbols (Uses Global EST: GEST) Pass II: performs actual loading, relocation and linking. 11/27/2020 56

Design of Direct linking loader… In Pass I , a Global External Symbol table(GEST)

Design of Direct linking loader… In Pass I , a Global External Symbol table(GEST) is prepared. It contain every external symbol and corresponding absolute address value. 11/27/2020 57

Fig. Two pass direct linking loader scheme Object Module Copy of object records Pass

Fig. Two pass direct linking loader scheme Object Module Copy of object records Pass I Object Module 11/27/2020 Pass II Main Memory GEST 58

Example Write entries of ESD, TXT, RLD, & Global External Symbol Table(GEST) for PG

Example Write entries of ESD, TXT, RLD, & Global External Symbol Table(GEST) for PG 1, PG 2 given below 11/27/2020 59

Object Record no. Relative Source Address Program 1. 0 PG 1 START 2. ENTRY

Object Record no. Relative Source Address Program 1. 0 PG 1 START 2. ENTRY PG 1 EN 1, PG 1 EN 2 3. EXTRN PG 2 EN 1, PG 2 4. 20 PG 1 EN 1 = 5. 30 PG 1 EN 2 = 6. 40 DC A (PG 1 EN 1) 7. 44 DC A (PG 1 EN 2+15) 8. 48 DC A (PG 1 EN 2 -PG 1 EN 1 -3) 9. 52 DC A 10. 56 DC A (PG 2 EN 1+PG 1 EN 1+4) 11/27/2020 (PG 2) 60

Object Record no. Relative Address Source Program 12. 0 PG 2 START 13. ENTRY

Object Record no. Relative Address Source Program 12. 0 PG 2 START 13. ENTRY PG 2 EN 2 14. EXTRN PG 1 EN 1, PG 1 EN 2 15. 16 16. 24 DC A (PG 1 EN 1) 17. 28 DC A (PG 1 EN 2+15) 18. 32 DC -3) A (PG 1 EN 2 -PG 1 EN 1 19. 36 END 11/27/2020 PG 2 EN 1 = 61

Object Records For Module PG 1: 1. ESD record Source Name object record no.

Object Records For Module PG 1: 1. ESD record Source Name object record no. Type ID Relative Address length 1. PG 1 SD 01 0 60 2. PG 1 EN 1 LD - 20 3. PG 1 EN 2 LD - 30 4. PG 2 ER 02 - 5. PG 2 EN 1 ER 03 - 11/27/2020 62

Explanation SD: Segment definition LD: Local definition (declared in this seg, can be used

Explanation SD: Segment definition LD: Local definition (declared in this seg, can be used by others) ER: External definition (declared in other , can be used by this) Each SD and ER symbol is given unique numeber which is to used in RLD 11/27/2020 63

TEXT records Source Relative object Address record no. Contents Comments 6 40 -43 20

TEXT records Source Relative object Address record no. Contents Comments 6 40 -43 20 ADDr PG 1 EN 1=20 7 8 9 10 44 -47 48 -51 52 -55 56 -59 45 7 0 -16 Addr PG 1 EN 2+15=45 Addr PG 1 EN 2 -PG 1 EN 1 -3= 7 Addr PG 2 is not known Addr of PG 2 EN 1 +PG 2 PG 1 EN 1+4 =0+0 -20+4 = -16 11/27/2020 64

Object Records For Module PG 1: 3. RLD record Source ESD_ID object record no.

Object Records For Module PG 1: 3. RLD record Source ESD_ID object record no. Length(in Flag + or Byte) Relative Address 6 01 4 + 40 7 01 4 + 44 9 02 4 + 52 10 03 4 + 56 10 02 4 + 56 11/27/2020 10 01 4 - 56 65

Object Records For Module PG 2: 1. ESD record Source Name object record no.

Object Records For Module PG 2: 1. ESD record Source Name object record no. Type ID Relative Address length 12. PG 2 SD 01 0 36 13. PG 2 ENT 1 LD - 16 - 14 PG 1 EN 1 ER 02 - - 14 PG 1 ENT 2 ER 03 - - 11/27/2020 66

TEXT records Source object record no. Relative Address Contents 16 24 -27 0 17

TEXT records Source object record no. Relative Address Contents 16 24 -27 0 17 28 -31 15 18 32 -35 -3 11/27/2020 67

Object Records For Module PG 1: 3. RLD record Source ESD_ID object record no.

Object Records For Module PG 1: 3. RLD record Source ESD_ID object record no. Length(in Flag + or Byte) Relative Address 16 02 4 + 24 17 03 4 + 28 18 03 4 + 32 18 02 4 - 32 11/27/2020 68

GEST Contain external symbol and its corresponding address. If we assume that PG 2

GEST Contain external symbol and its corresponding address. If we assume that PG 2 is loaded at location 268. External Symbol Assigned Memory Address PG 1 208 PG 1 ENT 1 228 PG 1 ENT 2 238 PG 2 268 PG 2 ENT 1 284 11/27/2020 69

LESA: Local External Symbol Array LESA is created for each segment. it contains SD

LESA: Local External Symbol Array LESA is created for each segment. it contains SD & LD type entries of each segment. Assigned Memory LESA for PG 1 Address LESA for PG 2 PG 1 208 PG 1 ENT 1 228 PG 1 ENT 2 238 Assigned Memory Address 11/27/2020 PG 2 268 PG 2 ENT 1 284 70

Assignment Question Write entries of ESD, TXT, RLD, & Global External Symbol Table(GEST) for

Assignment Question Write entries of ESD, TXT, RLD, & Global External Symbol Table(GEST) for MAIN, PRO given below Assume initial program load address as 400. 11/27/2020 71

Object Record no. Relative Source Address Program 1. 0 MAIN START 2. ENTRY M

Object Record no. Relative Source Address Program 1. 0 MAIN START 2. ENTRY M 1, M 2 3. EXTRN PROG, P 1, P 2 4. 20 M 1 = 5. 30 M 2 = 6. 50 DC A (M 2) 7. 54 DC A (M 1+5) 8. 58 DC A (M 2 -M 1 -4) 9. 62 DC A (PROG) 10. 66 DC A (P 1+P 2 -PROG) 11/27/2020 72

Object Record no. Relative Address Source Program 12. 0 PROG START 13. ENTRY P

Object Record no. Relative Address Source Program 12. 0 PROG START 13. ENTRY P 1, P 2 14. EXTRN M 1, M 2 15. 16 P 1 = 16. 26 P 2 = 17. 36 DC A (M 1) 18. 40 DC A (M 2+10) DC A (P 2 -P 1 -3) 19. 11/27/2020 73

Loader Design Options Linking loaders – all linking and relocation at load time Linkage

Loader Design Options Linking loaders – all linking and relocation at load time Linkage editors – perform linking prior to load time Dynamic linking – performed at execution time

Overlay Structure Program execution need not be achieved by loading all the parts of

Overlay Structure Program execution need not be achieved by loading all the parts of large program in memory. So, that we can reduce memory requirement of such program by loading required parts of program in memory. Hence some parts of program are given the same load address during linking. Therefore, at any time, only one of these parts of program can be loaded in memory because loading of other parts that has same load address will overwrite it. 11/27/2020 75

Overlay Structure… Overlay is a part of program that has same load origin as

Overlay Structure… Overlay is a part of program that has same load origin as some other parts of the program. and the program which contains overlays is called as overlay structured program. It consist of Permanently resident portion known as ROOT. Set of overlays that will e loaded in memory as per the requirements. Overlay manager is linked with the root. Root is loaded in memory. 11/27/2020 76

Example Suppose a program consisting of five subprograms (A{20 k}, B{20 k}, C{30 k},

Example Suppose a program consisting of five subprograms (A{20 k}, B{20 k}, C{30 k}, D{10 k}, and E{20 k}) that require 100 K bytes of core. Subprogram A only calls B, D and E; subprogram B only calls C and E; subprogram D only calls E subprogram C and E do not call any other routines Note that procedures B and D are never in used the same time; neither are C and E. 11/27/2020 77

11/27/2020 78

11/27/2020 78

Self- Relocatable Programs Classification of program based on how that program may be relocated

Self- Relocatable Programs Classification of program based on how that program may be relocated to execute from a specified area of memory as follows: 1. Non-relocatable program 2. Relocatable program 3. Self-relocatable rogram Self-relocatable program: Is a program which performs the relocation of address sensitive instruction by itself. The program performs its own relocation and does not require a linker.

Self- Relocatable Programs … Table of information of address sensitive instruction exists in program.

Self- Relocatable Programs … Table of information of address sensitive instruction exists in program. Code to perform the relocation of address sensitive instructions. This logic is called as Relocation Logic Start address of relocation logic is considered as execution starting address of a program. Self –Relocating program can execute in any memory.

11/27/2020 81

11/27/2020 81

11/27/2020 82

11/27/2020 82

11/27/2020 83

11/27/2020 83

11/27/2020 84

11/27/2020 84

11/27/2020 85

11/27/2020 85

11/27/2020 86

11/27/2020 86

11/27/2020 87

11/27/2020 87

11/27/2020 88

11/27/2020 88

11/27/2020 89

11/27/2020 89