loaders & linkers 2013

76
Loaders & Linkers

Upload: hariprasathk

Post on 17-Aug-2015

239 views

Category:

Documents


4 download

DESCRIPTION

loaders and linkers, system software

TRANSCRIPT

Loaders & LinkersIntroductionA Loaderis a program which accepts the object program as input, makes them executable by the computer and initiates execution.object fileIn computer science, object code, or an object file, is the representation of code that a compiler or assembler generates by processing a source code file. Object files contain compact code, often called "binaries".A linker is typically used to generate an executable file by linking object files together. he only essential element in an object file is machine code Object files often also contain data for use by the code at runtime, relocation information, program symbols !names of "ariables and functions# for linking and$or debugging purposes, and other debugging information.%asic &unctions of the 'oaderALLOCATION: Allocates space in memoryfor the programs! calculation program si(e#!LOCATION: Adjustment ofaddresses of all address sensiti"e entities.LIN"IN#:)esol"e inter*segment !inter*program# symbolic reference in objectprogram. LOA$IN#: +hysicallyplace the machine instructions and data into memory and initiate execution.'inkingIn general ,a program can contain ,- .xternal definitions- +ublic definitionsLinker is the system software which performs ,-)esolution of inter*segment symbolic referenceswhich is called as /Linking.-.stablish correspondence between external definitionsand public definitions-o determine relocatability of symbols attributes.-0ubstitute relocatable addresses.&unctions of a 'inker.stablish communication between external symbol references and definitions and public definitionso determine the relocatability of symbol attributes and expressions.o substitute for these relocatable addresses.In actual practice, a complete program is built from many smaller routines possibly by many people. All these routines ha"e to be connected logically and linked to form a single program. A linker is a systems program that accounts for and reconciles all address references within and among modules and replaces those references with a single consistent scheme of relati"e addresses.'inking is done after the code is generated and is closely associated with a loader.1ompilers and translators basically translate one procedure at a time and put the translated output on the disk. All the translated procedures ha"e to be located and linked together to be run as a unit called an executable binary program. In 20*3O0, 4indows 56$57 etc object modules ha"e extension .obj and the executable binary programs ha"e .exe extension. In 89I:, object modules ha"e .o extension and executable programs ha"e no extension 'oading schemes;. Assemble*and*go loader, he assembler simply places the code into memory and the loader executes a single instruction that transfers control to the starting instruction of the assembled program.