home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man5 / a.out.5 next >
Encoding:
Text File  |  1975-06-26  |  5.3 KB  |  190 lines

  1. .th A.OUT V 9/9/73
  2. .sh NAME
  3. a.out \*- assembler and link editor output
  4. .sh DESCRIPTION
  5. .it A.out
  6. is the output file of the assembler
  7. .it as
  8. and the link editor
  9. .it ld.
  10. Both programs make
  11. .it a.out
  12. executable if there were no
  13. errors and no unresolved external references.
  14. .s3
  15. This file has four sections:
  16. a header, the program and data text, a symbol table, and relocation bits
  17. (in that order).
  18. The last two may be empty
  19. if the program was loaded
  20. with the ``\*-s'' option
  21. of
  22. .it ld
  23. or if the symbols and relocation have been
  24. removed by
  25. .it strip.
  26. .s3
  27. The header always contains 8 words:
  28. .s3
  29. .lp +5 3
  30. 1    A magic number (407, 410, or 411(8))
  31. .lp +5 3
  32. 2    The size of the program text segment
  33. .lp +5 3
  34. 3    The size of the initialized portion of the data segment
  35. .lp +5 3
  36. 4    The size of the uninitialized (bss) portion of the data segment
  37. .lp +5 3
  38. 5    The size of the symbol table
  39. .lp +5 3
  40. 6    The entry location (always 0 at present)
  41. .lp +5 3
  42. 7    Unused
  43. .lp +5 3
  44. 8    A flag indicating relocation bits have been suppressed
  45. .s3
  46. .i0
  47. The sizes of each segment are in bytes but are even.
  48. The size of the header is not included in any of the other sizes.
  49. .s3
  50. When a file produced by the assembler or loader is
  51. loaded into core for execution, three logical segments are
  52. set up: the text segment, the data segment
  53. (with uninitialized data, which starts off as all 0, following
  54. initialized),
  55. and a stack.
  56. The text segment begins at 0
  57. in the core image; the header is not loaded.
  58. If the magic number (word 0) is 407, it indicates that the text
  59. segment is not to be write-protected and shared,
  60. so the data segment is immediately contiguous
  61. with the text segment.
  62. If the magic number is 410,
  63. the data segment begins at the first 0 mod 8K byte
  64. boundary following the text segment,
  65. and the text segment is not writable by the program;
  66. if other processes are executing the same file,
  67. they will share the text segment.
  68. If the magic number is 411,
  69. the text segment is again pure, write-protected, and shared,
  70. and moreover instruction and data space are separated;
  71. the text and data segment both begin at location 0.
  72. See the 11/45 handbook for restrictions which apply to this
  73. situation.
  74. .s3
  75. The stack will occupy the highest possible locations
  76. in the core image: from 177776(8) and growing downwards.
  77. The stack is automatically extended as required.
  78. The data segment is only extended as requested by
  79. the
  80. .it break
  81. system call.
  82. .s3
  83. The start of the text segment in the file is 20(8);
  84. the start of the data segment is 20+S\s6\dt\u\s10 (the size of the text)
  85. the start of the relocation information is
  86. 20+S\s6\dt\u\s10+S\s6\dd\u\s10;
  87. the start of the symbol table is
  88. 20+2(S\s6\dt\u\s10+S\s6\dd\u\s10)
  89. if the
  90. relocation information is present,
  91. 20+S\s6\dt\u\s10+S\s6\dd\u\s10
  92. if not.
  93. .s3
  94. The symbol table consists of 6-word entries.  The first
  95. four words contain the ASCII name of the symbol, null-padded.
  96. The next word is a flag indicating the type of symbol.
  97. The following values are possible:
  98. .s3
  99. .lp +6 3
  100. 00    undefined symbol
  101. .lp +6 3
  102. 01    absolute symbol
  103. .lp +6 3
  104. 02    text segment symbol
  105. .lp +6 3
  106. 03    data segment symbol
  107. .lp +6 3
  108. 37    file name symbol (produced by ld)
  109. .lp +6 3
  110. 04    bss segment symbol
  111. .lp +6 3
  112. 40    undefined external (.globl) symbol
  113. .lp +6 3
  114. 41    absolute external symbol
  115. .lp +6 3
  116. 42    text segment external symbol
  117. .lp +6 3
  118. 43    data segment external symbol
  119. .lp +6 3
  120. 44    bss segment external symbol
  121. .i0
  122. .s3
  123. Values other than those given above may
  124. occur if the user has defined some of his own instructions.
  125. .s3
  126. The last word of a symbol table entry contains the value of the symbol.
  127. .s3
  128. If the symbol's type is undefined external,
  129. and the value field is non-zero,
  130. the symbol is interpreted by the loader
  131. .it ld
  132. as
  133. the name of a common region
  134. whose size is indicated by the value of the
  135. symbol.
  136. .s3
  137. The value of a word in the text or data portions which is not
  138. a reference to an undefined external symbol
  139. is exactly that value which will appear in core
  140. when the file is executed.
  141. If a word in the text or data portion
  142. involves a reference to an undefined external symbol,
  143. as indicated by the relocation bits
  144. for that word,
  145. then the value of the word as stored in the file
  146. is an offset from the associated external symbol.
  147. When the file is processed by the
  148. link editor and the external symbol becomes
  149. defined, the value of the symbol will
  150. be added into the word in the file.
  151. .s3
  152. If relocation
  153. information is present, it amounts to one word per
  154. word of program text or initialized data.
  155. There is no relocation information if the ``suppress relocation''
  156. flag in the header is on.
  157. .s3
  158. Bits 3-1 of a relocation word indicate the segment referred
  159. to by the text or data word associated with the relocation
  160. word:
  161. .s3
  162. .lp +6 3
  163. 00    indicates the reference is absolute
  164. .lp +6 3
  165. 02    indicates the reference is to the text segment
  166. .lp +6 3
  167. 04    indicates the reference is to initialized data
  168. .lp +6 3
  169. 06    indicates the reference is to bss (uninitialized data)
  170. .lp +6 3
  171. 10    indicates the reference is to an undefined external symbol.
  172. .i0
  173. .s3
  174. Bit 0 of the relocation word indicates if
  175. .it on
  176. that the
  177. reference is relative to the pc (e.g. ``clr x'');
  178. if
  179. .it off,
  180. that
  181. the reference is to the actual symbol (e.g.,
  182. ``clr *$x'').
  183. .s3
  184. The remainder of the relocation word (bits 15-4)
  185. contains a symbol number in the case of external
  186. references, and is unused otherwise.
  187. The first symbol is numbered 0, the second 1, etc.
  188. .sh "SEE ALSO"
  189. as (I), ld (I), strip (I), nm (I)
  190.