|
|
1.1 root 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 or 410(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: .s3
69: The stack will occupy the highest possible locations
70: in the core image: from 177776(8) and growing downwards.
71: The stack is automatically extended as required.
72: The data segment is only extended as requested by
73: the
74: .it break
75: system call.
76: .s3
77: The start of the text segment in the file is 20(8);
78: the start of the data segment is 20+S\s6\dt\u\s10 (the size of the text)
79: the start of the relocation information is
80: 20+S\s6\dt\u\s10+S\s6\dd\u\s10;
81: the start of the symbol table is
82: 20+2(S\s6\dt\u\s10+S\s6\dd\u\s10)
83: if the
84: relocation information is present,
85: 20+S\s6\dt\u\s10+S\s6\dd\u\s10
86: if not.
87: .s3
88: The symbol table consists of 6-word entries. The first
89: four words contain the ASCII name of the symbol, null-padded.
90: The next word is a flag indicating the type of symbol.
91: The following values are possible:
92: .s3
93: .lp +6 3
94: 00 undefined symbol
95: .lp +6 3
96: 01 absolute symbol
97: .lp +6 3
98: 02 text segment symbol
99: .lp +6 3
100: 03 data segment symbol
101: .lp +6 3
102: 37 file name symbol (produced by ld)
103: .lp +6 3
104: 04 bss segment symbol
105: .lp +6 3
106: 40 undefined external (.globl) symbol
107: .lp +6 3
108: 41 absolute external symbol
109: .lp +6 3
110: 42 text segment external symbol
111: .lp +6 3
112: 43 data segment external symbol
113: .lp +6 3
114: 44 bss segment external symbol
115: .i0
116: .s3
117: Values other than those given above may
118: occur if the user has defined some of his own instructions.
119: .s3
120: The last word of a symbol table entry contains the value of the symbol.
121: .s3
122: If the symbol's type is undefined external,
123: and the value field is non-zero,
124: the symbol is interpreted by the loader
125: .it ld
126: as
127: the name of a common region
128: whose size is indicated by the value of the
129: symbol.
130: .s3
131: The value of a word in the text or data portions which is not
132: a reference to an undefined external symbol
133: is exactly that value which will appear in core
134: when the file is executed.
135: If a word in the text or data portion
136: involves a reference to an undefined external symbol,
137: as indicated by the relocation bits
138: for that word,
139: then the value of the word as stored in the file
140: is an offset from the associated external symbol.
141: When the file is processed by the
142: link editor and the external symbol becomes
143: defined, the value of the symbol will
144: be added into the word in the file.
145: .s3
146: If relocation
147: information is present, it amounts to one word per
148: word of program text or initialized data.
149: There is no relocation information if the ``suppress relocation''
150: flag in the header is on.
151: .s3
152: Bits 3-1 of a relocation word indicate the segment referred
153: to by the text or data word associated with the relocation
154: word:
155: .s3
156: .lp +6 3
157: 00 indicates the reference is absolute
158: .lp +6 3
159: 02 indicates the reference is to the text segment
160: .lp +6 3
161: 04 indicates the reference is to initialized data
162: .lp +6 3
163: 06 indicates the reference is to bss (uninitialized data)
164: .lp +6 3
165: 10 indicates the reference is to an undefined external symbol.
166: .i0
167: .s3
168: Bit 0 of the relocation word indicates if
169: .it on
170: that the
171: reference is relative to the pc (e.g. ``clr x'');
172: if
173: .it off,
174: that
175: the reference is to the actual symbol (e.g.,
176: ``clr *$x'').
177: .s3
178: The remainder of the relocation word (bits 15-4)
179: contains a symbol number in the case of external
180: references, and is unused otherwise.
181: The first symbol is numbered 0, the second 1, etc.
182: .sh "SEE ALSO"
183: as(I), ld(I), strip(I), nm(I)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.