home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / info / object.fmt < prev    next >
Text File  |  1987-07-10  |  9KB  |  249 lines

  1. Here  is the format of object files generated by the  macro  assembler
  2. and Microsoft C Compiler.
  3.  
  4.     +---------------------------------------+
  5.     | BYTE    Record type            |
  6.     |    80    Module name        |
  7.     |    82                |
  8.     |    84                |
  9.     |    86                |
  10.     |    88                |
  11.     |    8A    End of module        |
  12.     |    8C    External symbols    |
  13.     |    8E                |
  14.     |    90    Public symbols        |
  15.     |    92                |
  16.     |    94    Line number info    |
  17.     |    96    Segment/Group symbols    |
  18.     |    98    Info for specific seg    |
  19.     |    9A    Info for specific group    |
  20.     |    9C    Relocation list        |
  21.     |    9E                |
  22.     |    A0    Segment data        |
  23.     |    A2    Duplicated Segment Data    |
  24.     +---------------------------------------+
  25.     | WORD    Count of bytes in record, inc-    |
  26.     |    luding the record checksum, but    |
  27.     |    not including record type or     |
  28.     |    byte count            |
  29.     +---------------------------------------+
  30.     | ....    Record  Data  ....        |
  31.     |    See specific record for details |
  32.     +---------------------------------------+
  33.     | BYTE    Checksum of all characters in   |
  34.     |    record, including record type    |
  35.     +---------------------------------------+
  36.  
  37.  
  38. Now for each one of the record types.  In the following  descriptions,
  39. certain  terminology will be used.  Many of these record use a  number
  40. which  relates some particular field to a value.  These numbers  range
  41. from  1-255.  In some cases, this number will relate an  instantiation
  42. of  a symbol to the name of the symbol.  In other cases,  this  number
  43. will  relate the segment or group instance with the actual segment  or
  44. group of the instantiation.
  45.  
  46. Module Name record (80) This record specifies the name of the  module.
  47. The record data field will be filled in as follows:
  48.     +---------------------------------------+
  49.     | BYTE    Length of Module name        |
  50.     +---------------------------------------+
  51.     | (Length) BYTES   Module Name        |
  52.     +---------------------------------------+
  53.  
  54. End of Module record (8A)
  55. This record specifies the end of the module.  The record  data  field
  56. will be filled with a zero byte
  57.     +---------------------------------------+
  58.     | BYTE    Zero                |
  59.     +---------------------------------------+
  60.  
  61.  
  62. External  Symbols Record (8C)
  63. This  record specifies the names of the external symbols.  The  record
  64. data  field is filled in as follows, and record data  fields  defining
  65. the symbols may appear more than once.
  66.     +---------------------------------------+
  67.     | BYTE    Length  of external symbol    |
  68.     +---------------------------------------+
  69.     | (Length) BYTES    External symbol name|
  70.     +---------------------------------------+
  71.     | BYTE    Zero                |
  72.     +---------------------------------------+
  73.  
  74. Public Symbols Record (90)
  75. This record defines the symbols declared as public symbols.  Only  one
  76. symbol  will appear per record data field.  The record data  field  is
  77. defined as follows:
  78.     +---------------------------------------+
  79.     | BYTE    Zero                |
  80.     +---------------------------------------+
  81.     | BYTE    Segment number in which symbol    |
  82.     |    is defined            |
  83.     +---------------------------------------+
  84.     | BYTE    Length of symbol        |
  85.     +---------------------------------------+
  86.     | (Length) BYTES    Public Symbol Name    |
  87.     +---------------------------------------+
  88.     | WORD    Offset where symbol defined    |
  89.     +---------------------------------------+
  90.     | BYTE    Zero                |
  91.     +---------------------------------------+
  92.  
  93.  
  94. Line Number Information Record (94)
  95. This  record  defines   line   number   debugging  information.   This
  96. information is in the form of the line number of the source file,  and
  97. the  address  at  which the code corresponding  to  that  line  number
  98. starts.  The record data field will be filled in as follows:
  99.     +---------------------------------------+
  100.     | BYTE    Zero                |
  101.     +---------------------------------------+
  102.     | BYTE    Segment number            |
  103.     +---------------------------------------+
  104.     | WORD    Line number in source file    |
  105.     +---------------------------------------+
  106.     | WORD    Offset of start of line        |
  107.     +---------------------------------------+
  108.  
  109. For  this  record, the last two field may be repeated  any  number  of
  110. times.
  111.  
  112.  
  113. Segment/Group Symbols Record  (96)
  114. This record defines the names of the symbols used in the module  name,
  115. segment names, and group names.  The segment symbol numbers the relate
  116. the  segment  numbers  to this name.  The record data  field  will  be
  117. filled in as follows:
  118.     +---------------------------------------+
  119.     | BYTE    Zero                |
  120.     +---------------------------------------+
  121.     | BYTE    Length of symbol name        |
  122.     +---------------------------------------+
  123.     | (Length) BYTES  Symbol Name        |
  124.     +---------------------------------------+
  125.  
  126. The last two field may be repeated any number of times.
  127.  
  128.  
  129. Segment Specific Information Record  (98)
  130. This  record defines the combine and alignment classes of  a  specific
  131. segment.   Segment  numbers are assigned in the order in  which  these
  132. records  may appear.  The first occurrence of this record defines  the
  133. first memory segment, and so on.  The record data field will be filled
  134. in as follows:
  135.     +---------------------------------------+
  136.     | BYTE    Combine/Alignment Class:    |
  137.     |    is defined as 0AAXPS00        |
  138.     |    where AA is the alignment class    |
  139.     |        00=AT (Specific segment |
  140.     |           alignment)        |
  141.     |        01=BYTE boundary    |
  142.     |        10=WORD boundary    |
  143.     |        11=PARAGRAPH boundary    |
  144.     |          X is unknown: used in stk    |
  145.     |          P is a public segment    |
  146.     |          S is a stack segment    |
  147.     +---------------------------------------+
  148.     | WORD    Segment size in bytes        |
  149.     +---------------------------------------+
  150.     | BYTE    Segment/Group Symbol Number    |
  151.     +---------------------------------------+
  152.     | BYTE    Not sure just yet.        |
  153.     +---------------------------------------+
  154.     | BYTE    Not sure just yet: usually 1    |
  155.     +---------------------------------------+
  156.  
  157.  
  158. Group Specific Information Record  (9A)
  159. This  record defines the memory segments which will be contained in  a
  160. group.  The format of the record data field is defines as follows:
  161.     +---------------------------------------+
  162.     | BYTE    Segment/Group Symbol Number    |
  163.     +---------------------------------------+
  164.     | BYTE    FF                |
  165.     +---------------------------------------+
  166.     | BYTE    Segment number            |
  167.     +---------------------------------------+
  168.  
  169. The last two field will be repeated for every segment in a group.
  170.  
  171.  
  172. Relocation List Record  (9C)
  173. This record defines the offsets in the just previously defined  memory
  174. segment  which need fixing up.  Multiple fixups may occur in the  data
  175. record field, and is defined as follows:
  176.     +---------------------------------------+
  177.     | BYTE    Attributes needed/Relocation    |
  178.     |    offset MSB and is defined as:    |
  179.     |    1A00SOFFF  where        |
  180.     |    A means absolute address needed    |
  181.     |    S means segment number needed    |
  182.     |    O means offset needed        |
  183.     |    FFF is the 3 Least Significant  |
  184.     |        bits of the MSB of fixup    |
  185.     |        offset            |
  186.     +---------------------------------------+
  187.     | BYTE    LSB of fixup offset        |
  188.     +---------------------------------------+
  189.     | BYTE    Relocation type    and is defined    |
  190.     |    as 00LG0AE0 where        |
  191.     |    L means length of symbol needed    |
  192.     |    G means group override        |
  193.     |    A means the address is needed    |
  194.     |    E means the symbol is external    |
  195.     +---------------------------------------+
  196.     | BYTE    Group/Segment number.  If Bit 4    |
  197.     |    of the previous byte was set,     |
  198.     |    this will be a group number,    |
  199.     |    otherwise it is segment number    |
  200.     +---------------------------------------+
  201.     | BYTE    Destination Segment Number    |
  202.     +---------------------------------------+
  203.     | BYTE    Source Symbol/Segment Number    |
  204.     +---------------------------------------+
  205.     | WORD    Destination offset if Relocation|
  206.     |    type byte is zero, otherwise    |
  207.     |    nonexistant.            |
  208.     +---------------------------------------+
  209.  
  210.  
  211. Memory Segment Information Record  (A0)
  212. This  record  defines  the contents of a memory  segment.   One record
  213. for  each segment will appear for each segment which has locations  to
  214. be  defined.   For program code, this will be the  actual  code.   For
  215. data,  this will be the initial contents of the  data.     No   memory
  216. segment record will exceed 1024 bytes, because of the relocation  list
  217. which  may follow.  The format of the data record field is defined  as
  218. follows:
  219.     +---------------------------------------+
  220.     | BYTE    Memory segment number        |
  221.     +---------------------------------------+
  222.     | WORD    Origin in segment        |
  223.     +---------------------------------------+
  224.     | .....  Data for Segment  .....    |
  225.     +---------------------------------------+
  226.  
  227.  
  228. Duplicate Memory Segment Information Record  (A2)
  229. This record defines the contents of duplicated memory segment, such as
  230. when  the assembler encounters a DUP in DB directive.  The  format  of
  231. the data record field is defines as follows:
  232.     +---------------------------------------+
  233.     | BYTE    Memory Segment Number        |
  234.     +---------------------------------------+
  235.     | WORD    Origin in Segment        |
  236.     +---------------------------------------+
  237.     | WORD    Number of Duplication times    |
  238.     +---------------------------------------+
  239.     | WORD    1                |
  240.     +---------------------------------------+
  241.     | WORD    1                |
  242.     +---------------------------------------+
  243.     | WORD    0                |
  244.     +---------------------------------------+
  245.     | BYTE    Length of DUP item        |
  246.     +---------------------------------------+
  247.     | (Length) BYTES   DUP data        |
  248.     +---------------------------------------+
  249. ▒S