180 likes | 199 Views
Learn about Absolute and Relocatable loaders, object file formats, linking, addressing, and dynamic/static linking for efficient program execution.
E N D
Ştefan Stăncescu PART ISISTEM UTILITIES LECTURE 4.1 LINK_LOAD
LINK-LOADAbsolute loader • 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)
LINK-LOADRelocatability • Relocatability ability, for an objectfile loaded (with minimum modifications) at any address in memory • ofbeing able to work well. • For linking • more obj. file in a single compact obj. file • 2. For dynamic memory management
LINK-LOADRelocatable object file formatAddress modifier M separate section
LINK-LOADRelocatable object file formatRelocation mask in section “C”
LINK-LOADReferences • Referencessymbolic namesin link process, • names transmitted between object files - modules defined in one single object module • used in many (any other object modules). • EXTERN referencessymbolic names • defined in another object module than • the object module in which they are used. • PUBLIC referencessymbolic names • defined in current object module but able to be used in another object modules
LINK-LOADLinking • Link-editingor, 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
LINK-LOAD Linking • 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 expressionmust have only invariants at loading time, (no + or * or /, only -) as in, • LUNGIME_ZONA EQU END_ZONA – START_ZONA
LINK-LOADStatic link • 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.
LINK-LOADDynamic link • 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
LINK-LOADLINK EDITOR - EXEMPLE • LINK- EDITOR DATA STRUCTURES • ESTAB - tablewith • module names associated with address locations in the final object file, • EXTERN and PUBLIC references names, • for PUBLIC references, their addressesin the final linked module. • PROGADR - address register for linked program module load address; • CSADR- current module first code address registerwith • 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.