Presentation is loading. Please wait.

Presentation is loading. Please wait.

PART I SISTEM UTILITIES LECTURE 4.1 LINK_LOAD Ştefan Stăncescu 1.

Similar presentations


Presentation on theme: "PART I SISTEM UTILITIES LECTURE 4.1 LINK_LOAD Ştefan Stăncescu 1."— Presentation transcript:

1 PART I SISTEM UTILITIES LECTURE 4.1 LINK_LOAD Ştefan Stăncescu 1

2 LINK-LOAD Absolute loader 2 Loading of an object file (asembled with a assembler, compiler, etc.) => object file prepare and transfer in machine memory Absolute loader when loading is direct, without preparing at address specified in the object file format specified address (Simple systems, embedded processors)

3 LINK-LOAD Absolute loader 3

4 LINK-LOAD Relocatability 4 Relocatability ability, for an object file loaded (with minimum modifications) at any address inmemory of being able to work well. 1.For linking more obj. file in a single compact obj. file 2.For dynamic memory management

5 LINK-LOAD Relocatable object file format Address modifier M separate section 5 NameNo. crt. byteField semantic Modifier1Field character „M” 2-3Modification size 4-35Relative location addresses in object file format “C” section, which are needed to be modified before link-load for relocatability

6 LINK-LOAD Relocatable object file format Relocation mask in section “C” 6 NameNo. crt. byteField semantic Content16Object field code, character „C” 17-18Current stripe starting address 19-20Current stripe length 21-36Code length / 8 = relocation mask length 37-164Assembled object code (128 bytes as example), 165-576Repeat n(=3 times as example) the 17- 164 zone

7 LINK-LOAD References 7 References symbolic names in link process, names transmitted between object files - modules defined in one single object module used in many (any other object modules). EXTERN references symbolic names defined in another object module than the object module in which they are used. PUBLIC references symbolic names defined in current object module but able to be used in another object modules

8 LINK-LOAD Relocatable object file format PUBLIC references 8 NameNo. crt. byteField semantic PUBLIC1PUBLIC field code, character „D”, 2-9PUBLIC symbolic name identifier 10-13Relative address PUBLIC symbol name, in the originating object code 14-73Repeat 2-13 positions, for any other PUBLIC name symbols (5 as example)

9 LINK-LOAD Relocatable object file format EXTERN references 9 NameNo. crt. byteField semantic EXTERN1EXTERN field code, character „E”, 2-9EXTERN symbolic name identifier 10-44Repeat 2-9 positions, for any other EXTERN name symbols (5 as example)

10 LINK-LOAD Linking 10 Link-editing or, shortly, linking, is the modify address process for a relocatable object file, in view to join another object files, with the aim to constitute a compact object file. The corresponding system utility is the link-editor (linker). Following a link, the obtained linked object file is relocatable and may be linked further to another object files

11 LINK-LOAD Linking 11 Address expression calculus in source files issue: for arithmetic expressions with relative addresses the calculus must gives an relative address result that must not depend of real address location of the linked object file, loaded in real memory at an address determined at the load time. Not all arithmetic expressions are equally permitted A correct expression must have only invariants at loading time, (no + or * or /, only -) as in, LUNGIME_ZONA EQU END_ZONA – START_ZONA

12 LINK-LOAD Static link 12 Static link generate a new relocatable object file, compact and remanent, to be loaded in any place in memory, established by the operating system before each run. Static link efficiency – when stable, repetitive general conditions and products in the process development at each run In such case, link time is only used at first run, others are for free.

13 LINK-LOAD Dynamic link 13 Dynamic link postpone link work until the last moment before each run, only needed object files are chosen and linked taking in account about program run state determined by current processing values obtained from current input data. The memory space is optimized, spares, not needed object files are not linked, nor loaded in the memory

14 LINK-LOAD Linker and loader 14

15 LINK-LOAD Link-loader 15

16 LINK-LOAD LINK EDITOR - EXEMPLE 16 LINK- EDITOR DATA STRUCTURES ESTAB - table with module names associated with address locations in the final object file, EXTERN and PUBLIC references names, for PUBLIC references, their addresses in the final linked module. PROGADR- address register for linked program module load address; CSADR - current module first code address register with the reference address for all relative addresses of the current object module in linking process. CSLTH - current module length register. EXECADR - execution address register with starting program address.

17 LINK-LOAD EDITOR DE LEGATURI - EXEMPLU - PAS I 17

18 LINK-LOAD EDITOR DE LEGATURI - EXEMPLU - PAS II 18


Download ppt "PART I SISTEM UTILITIES LECTURE 4.1 LINK_LOAD Ştefan Stăncescu 1."

Similar presentations


Ads by Google