Chapter 3 Loaders and LinkersPurpose and FunctionKinds of LoadersKinds of loaders (cont.)Slide 5Methods of RelocationMask Method of RelocationProgram LinkingLOADINGData Structures for LoadingChapter 3Loaders and LinkersPurpose and FunctionPlaces object program in memoryLinking–Combines 2 or more obj programsRelocation–Allows loading at different locationsLinkage Editor–Provides linking without loadingKinds of LoadersAbsolute–Single pass–Checks for correct header record–Checks for sufficient available memory–Moves each text record to proper location–Upon seeing END passes control to the pgmKinds of loaders (cont.)bootstrap–A special absolute loader–ROM–Loads the OSKinds of loaders (cont.)Relocating–Modifies appropriate addresses–Loads object program at a variety of locations–May perform loading during execution (repeatedly)–Allows for multiple programs (multiprocessing)–System libraries require relocationMethods of RelocationModification recordsUse absolute addressing and fixed format–No modification records required–Use same text records with flag (relocation bit)–Relocation bits gathered into a mask–If relocation bit is 1, add starting address to wordMask Method of RelocationHCOPY 000000001077A ^ ^ ^T0000001EFFC1400334810390000362800303000154810613C000300002A0C003900002D ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^FFC 111111111100 all 10 words need modificationT 00001E 15 E00 0C0036 481061 080033 4C0000 454F46 000003 000000^ ^ ^ ^ ^ ^ ^ ^ ^ ^E00 111000000000 instructions 0,1,2 need load addresses T0000391EFFC0400300000030E0105D30103FD8105D2800303010575480392C105E38103F ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^T0010570A8001000364C0000F1001000^ ^ ^ ^ ^ ^ ^The F1 fouls up alignment, thus a new text record has to be started. FIGURE 3.7Program LinkingNecessary for separate CSECTSExternal ReferencesExternal DefinitionsLOADINGForward references to external symbols commonUse 2 pass–Pass 1 assigns addr. to external symbolsProvides a load map (info in symbol table)–Pass 2 performs actual loading, relocation, and linkingData Structures for LoadingESTAB external symbol table – Stores–Names–Addresses–CSECT of external symbolsPROGADDR – program load address–Provided by the OSCSADDR – CSECT addr. of control sect.
View Full Document