LINKER FOR MS DOS

Views:
 
Category: Education
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

LINKER FOR MS DOS:

LINKER FOR MS DOS - Dinesh Manvar

Object Module Format:

Object Module Format An intel 8088 object module is a sequence of object record describing specific aspects of the program in the object module. There are 14 types of object records containing the following 5 basic categories of information Binary image (i.e. code generated by a translator) External references. Public definitions. Debugging information (e.g. line number in source program). Miscellaneous information (e.g. comments in the source program). We only consider the object record corresponding to first three categories-a total of 8 record types 2 7 March 2011

Object Records of intel 8088:

Object Records of intel 8088 Record type ID(Hex) Description THEADER 80 Translator header address. LNAMES 96 List of names record. SEGDEF 98 Segment definition record. EXTDEF 8C External names definition record. PUBDEF 90 Public names definition record. LEDATA A0 Enumerated data (binary image) FIXUPP 9C Fix up record. MODEND 8A Module end record.

Slide 4:

The object module must appear in the specific order shown in above table. Each object record contains variable length information and may refer to the contents of previous object records. Each name in an object record is represented in the following format: 4 Length (1 byte) N ame 7 March 2011

1. THEADER records:

1. THEADER records The module name in THEADER record is typically derived by the translator from the source file name. This name is used by the linker to report errors. 5 80H length T-module name Check-sum 7 March 2011

2. LNAMES records:

2. LNAMES records An assembly programmer can specify the module name in NAME directive. This record lists the names for use by SEGDEF records. 6 96H length Name list Check-sum 7 March 2011

3. SEGDEF records:

3. SEGDEF records This record designates a segment name using an index into LNAMES list. Attribute field indicates whether the segment is relocatable or absolute. Whether (and in what manner ) it can be combined with other segments as also the alignment requirement of its base address. Stack segments with the same name are concatenated with each other, while common segments with the same name are overlapped with one another. The attribute field also contains the origin specification for an absolute segment. 7 98H length Attributes (1-4) Check-sum Segment length (2) Name index (1) 7 March 2011

4. EXTDEF records:

4. EXTDEF records This record contains a list of external references used by the programs of this module. A FIXUPP record designates an external symbols name by using an index into this list. 8 8CH length External reference list Check-sum 7 March 2011

5. PUBDEF records:

5. PUBDEF records It contains the list of public names declared in a segment of the object module. The base specification identifies the segment Each ( name, offset ) pair in the record defines one public name. Specifying the name of the symbol and its offset within the segment designed by the base specification. 9 90H length Base(2-4) name Offset(2) ..... Check-sum 7 March 2011

6. LEDATA records:

6. LEDATA records It contains the binary image of the code generated by the language translator. Segment index identifies the segment to which the code belongs, and offset specifies the location of the code within the segment. 10 A 0H length Segment index(1-2) Data offset(2) data Check-sum 7 March 2011

7. FIXUPP records:

7. FIXUPP records It contains information for one or more relocation and linking fixups to be performed. The locat field contains a numeric code called loc code to indicate the type of a fixup. The meanings of these codes are given below: 11 Loc code Meanings 0 Low order byte is to be fixed 1 Offset is to be fixed 2 Segment is to be fixed 3 Pointer (i.e. segment: offset) is to be fixed 9CH length Locat(1) Fix dat Frame datum(1) Target datum(1) Target offset(2) … Check sum 7 March 2011

Slide 12:

Locat also contains the offset of the fixup location in the previous LEDATA record. The frame datum field , which refers to a SEGDEF record , identifies the segment to which the fixup location belongs. The target datum and target offset fields specify the relocation or linking information. Target datum contains a segment index or an external index, while target offset contains an offset from the name indicated in target datum. The fix dat field indicates the manner in which the target datum and target offset fields are to be interpreted. The numeric codes used for this purpose are given below : 12 Code Contents of target datum and offset datum 0 Segment index and displacement 2 External index and target displacement 4 Segment index(offset field is not used) 6 External index(offset field is not used) 7 March 2011

Contd….:

Contd…. 13 7 March 2011

authorStream Live Help