Commit | Line | Data |
---|---|---|
923e9e63 KT |
1 | .TH A.OUT 5 |
2 | .SH NAME | |
3 | a.out \- assembler and link editor output | |
4 | .SH SYNOPSIS | |
5 | .B #include <a.out.h> | |
6 | .SH DESCRIPTION | |
7 | .I A.out | |
8 | is the output file of the assembler | |
9 | .IR as (1) | |
10 | and the link editor | |
11 | .IR ld (1). | |
12 | Both programs make | |
13 | .I a.out | |
14 | executable if there were no | |
15 | errors and no unresolved external references. | |
16 | Layout information as given in the include file for the PDP11 is: | |
17 | .PP | |
18 | .nf | |
19 | .ta 8n +9n +11n | |
20 | .PP | |
21 | .so /usr/include/a.out.h | |
22 | .fi | |
23 | .PP | |
24 | The file has four sections: | |
25 | a header, the program and data text, | |
26 | relocation information, and a symbol table | |
27 | (in that order). | |
28 | The last two may be empty | |
29 | if the program was loaded | |
30 | with the `\-s' option | |
31 | of | |
32 | .I ld | |
33 | or if the symbols and relocation have been | |
34 | removed by | |
35 | .IR strip (1). | |
36 | .PP | |
37 | In the header the sizes of each section are given in bytes, but are even. | |
38 | The size of the header is not included in any of the other sizes. | |
39 | .PP | |
40 | When an | |
41 | .I a.out | |
42 | file is loaded into core for execution, three logical segments are | |
43 | set up: the text segment, the data segment | |
44 | (with uninitialized data, which starts off as all 0, following | |
45 | initialized), | |
46 | and a stack. | |
47 | The text segment begins at 0 | |
48 | in the core image; the header is not loaded. | |
49 | If the magic number in the header is 0407(8), it indicates that the text | |
50 | segment is not to be write-protected and shared, | |
51 | so the data segment is immediately contiguous | |
52 | with the text segment. | |
53 | If the magic number is 0410, | |
54 | the data segment begins at the first 0 mod 8K byte | |
55 | boundary following the text segment, | |
56 | and the text segment is not writable by the program; | |
57 | if other processes are executing the same file, | |
58 | they will share the text segment. | |
59 | If the magic number is 411, | |
60 | the text segment is again pure, write-protected, and shared, | |
61 | and moreover instruction and data space are separated; | |
62 | the text and data segment both begin at location 0. | |
63 | If the magic number is 0405, the text segment | |
64 | is overlaid on an existing (0411 or 0405) text segment | |
65 | and the existing data segment is preserved. | |
66 | .PP | |
67 | The stack will occupy the highest possible locations | |
68 | in the core image: from 0177776(8) and growing downwards. | |
69 | The stack is automatically extended as required. | |
70 | The data segment is only extended as requested by | |
71 | .IR brk (2). | |
72 | .PP | |
73 | The start of the text segment in the file is 020(8); | |
74 | the start of the data segment is 020+S\s6\dt\u\s10 (the size of the text) | |
75 | the start of the relocation information is | |
76 | 020+S\s6\dt\u\s10+S\s6\dd\u\s10; | |
77 | the start of the symbol table is | |
78 | 020+2(S\s6\dt\u\s10+S\s6\dd\u\s10) | |
79 | if the | |
80 | relocation information is present, | |
81 | 020+S\s6\dt\u\s10+S\s6\dd\u\s10 | |
82 | if not. | |
83 | .PP | |
84 | The layout of a symbol table entry and the principal flag values | |
85 | that distinguish symbol types are given in the include file. | |
86 | Other flag values may occur if an assembly language program | |
87 | defines machine instructions. | |
88 | .PP | |
89 | If a symbol's type is undefined external, | |
90 | and the value field is non-zero, | |
91 | the symbol is interpreted by the loader | |
92 | .I ld | |
93 | as | |
94 | the name of a common region | |
95 | whose size is indicated by the value of the | |
96 | symbol. | |
97 | .PP | |
98 | The value of a word in the text or data portions which is not | |
99 | a reference to an undefined external symbol | |
100 | is exactly that value which will appear in core | |
101 | when the file is executed. | |
102 | If a word in the text or data portion | |
103 | involves a reference to an undefined external symbol, | |
104 | as indicated by the relocation information | |
105 | for that word, | |
106 | then the value of the word as stored in the file | |
107 | is an offset from the associated external symbol. | |
108 | When the file is processed by the | |
109 | link editor and the external symbol becomes | |
110 | defined, the value of the symbol will | |
111 | be added into the word in the file. | |
112 | .PP | |
113 | If relocation | |
114 | information is present, it amounts to one word per | |
115 | word of program text or initialized data. | |
116 | There is no relocation information if the `relocation info stripped' | |
117 | flag in the header is on. | |
118 | .PP | |
119 | Bits 3-1 of a relocation word indicate the segment referred | |
120 | to by the text or data word associated with the relocation | |
121 | word: | |
122 | .TP | |
123 | 000 | |
124 | absolute number | |
125 | .br | |
126 | .ns | |
127 | .TP | |
128 | 002 | |
129 | reference to text segment | |
130 | .br | |
131 | .ns | |
132 | .TP | |
133 | 004 | |
134 | reference to initialized data | |
135 | .br | |
136 | .ns | |
137 | .TP | |
138 | 006 | |
139 | reference to uninitialized data (bss) | |
140 | .br | |
141 | .ns | |
142 | .TP | |
143 | 010 | |
144 | reference to undefined external symbol | |
145 | .PP | |
146 | Bit 0 of the relocation word indicates, if 1, | |
147 | that the | |
148 | reference is relative to the pc (e.g. `clr x'); | |
149 | if 0, | |
150 | that | |
151 | the reference is to the actual symbol (e.g., | |
152 | `clr *$x'). | |
153 | .PP | |
154 | The remainder of the relocation word (bits 15-4) | |
155 | contains a symbol number in the case of external | |
156 | references, and is unused otherwise. | |
157 | The first symbol is numbered 0, the second 1, etc. | |
158 | .SH "SEE ALSO" | |
159 | as(1), ld(1), nm(1) |