3/15/72 A.OUT (V)
NAME a.out -- assembler and link editor output
SYNOPSIS --
DESCRIPTION a.out is the output file of the assembler as and
the link editor ld. In both cases, a.out is exe-
cutable provided there were no errors and no un-
resolved external references.
This file has four sections: a header, the pro-
gram and data text, a symbol table, and reloca-
tion bits (in that order). The last two may be
empty if the program was loaded with the "-s" op-
tion of ld or if the symbols and relocation have
been removed by strip.
The header always contains 8 words:
1 a "br .+20" instruction (407(8))
2 The size of the program text segment
3 The size of the initialized data segment
4 The size of the uninitialized (bss) segment
5 The size of the symbol table
6 The entry location (always 0 at present)
7 The stack size required (0 at present)
8 A flag indicating relocation bits have been
suppressed
The sizes of each segment are in bytes but are
even. The size of the header is not included in
any of the other sizes.
When a file produced by the assembler or loader
is loaded into core for execution, three logical
segments are set up: the text segment, the data
segment, and uninitialized segment, in that or-
der. The text segment begins at the lowest loca-
tion in the core image; the header is not loaded.
The data segment begins immediately after the
text segment, and the bss segment immediately af-
ter the data segment. The bss segment is ini-
tialized by 0's. In the future the text segment
will be write-protected and shared.
The start of the text segment in the file is
20(8); the start of the data segment is 20+S
t
(the size of the text) the start of the reloca-
tion information is 20+S +S ; the start of the
t d
symbol table is 20+2(S +S ) if the relocation in-
t d
formation is present, 20+S +S if not.
t d
The symbol table consists of 6-word entries. The
first four contain the ASCII name of the symbol,
null-padded. The next word is a flag indicating
the type of symbol. The following values are
possible:
00 undefined symbol
01 absolute symbol
02 text segment symbol
03 data segment symbol
04 bss segment symbol
40 undefined external (.globl) symbol
41 absolute external symbol
42 text segment external symbol
43 data segment external symbol
44 bss segment external symbol
Values other than those given above may occur if
the user has defined some of his own instruc-
tions.
The last word of a symbol table entry contains
the value of the symbol.
If the symbol's type is undefined external, and
the value field is non-zero, the symbol is inter-
preted by the loader ld as the name of a common
region whose size is indicated by the value of
the symbol.
If a.out contains no unresolved global refer-
ences, the text portions are exactly as they will
appear in core when the file is executed. If the
value of a word in the text portion involves a
reference to an undefined global, the word is re-
placed by the offset to be added to the symbol's
value when it becomes defined.
If relocation information is present, it amounts
to one word per word of program text or initial-
ized data. There is no relocation information if
the "suppress relocation" flag in the header is
on.
Bits 3-1 of a relocation word indicate the seg-
ment referred to by the text or data word associ-
ated with the relocation word:
00 indicates the reference is absolute
02 indicates the reference is to the text seg-
ment
04 indicates the reference is to the data seg-
ment
06 indicates the reference is to the bss seg-
ment
10 indicates the reference is to an undefined
external symbol.
Bit 0 of the relocation word indicates if on that
the reference is relative to the pc (e.g. "clr
x"); if off, the reference is to the actual sym-
bol (e.g., "clr *$x").
The remainder of the relocation word (bits 15-4)
contains a symbol number in the case of external
references, and is unused otherwise. The first
symbol is numbered 0, the second 1, etc.
FILES --
SEE ALSO as, ld, strip, nm, un(I)
DIAGNOSTICS --
BUGS --
OWNER dmr