V3/usr/man/man5/a.out.5

Find at most related files.
including files from this version of Unix.

.pa 1
.he 'A.OUT (V)'3/15/72'A.OUT (V)'
.ti 0
.nf
NAME		a.out  --   assembler and link editor output
.fi
.sp
.ti 0
DESCRIPTION
.br
.in 8
a.out_____
is the output file of the assembler as__ and the link editor ld__.
In both cases, a.out_____ may be executed provided there
were no errors and no unresolved external references.
.sp
This file has four sections:
a header, the program and data text, a symbol table, and relocation bits
(in that order).
The last two may be empty
if the program was loaded
with the "-s" option
of ld__ or if the symbols and relocation have been
removed by strip_____.

The header always contains 8 words:

.in +6
.ti -3
1  A magic number (407(8))
.ti -3
2  The size of the program text segment
.ti -3
3  The size of the initialized data segment
.ti -3
4  The size of the uninitialized (bss) segment
.ti -3
5  The size of the symbol table
.ti -3
6  The entry location (always 0 at present)
.ti -3
7  The stack size required (0 at present)
.ti -3
8  A flag indicating relocation bits have been suppressed

.in -6
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 segments are
set up: the text segment, the data segment,
and the bss (uninitialized data) segment,
in that order.
The text segment begins at the lowest
location in the core image; the header is not loaded.
The data segment begins immediately after the text
segment, and the bss segment immediately after
the data segment.
The bss segment is initialized 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+S9t8 (the size of the text)
the start of the relocation information is 20+S9t8+S9d8;
the start of the symbol table is 20+2(S9t8+S9d8) if the
relocation information is present, 20+S9t8+S9d8 if not.

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 instructions.

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 interpreted by the loader ld__ as
the name of a common region
whose size is indicated by the value of the
symbol.

The value of a word in the text or data portions which is not
a reference to an undefined external symbol
is exactly that value which will appear in core
when the file is executed.
If a word in the text or data portion
involves a reference to an undefined external symbol,
as indicated by the relocation bits
for that word,
then the value of the word as stored in the file
is an offset from the associated external symbol.
When the file is processed by the
link editor and the external symbol becomes
defined, the value of the symbol will
be added into the word in the file.

If relocation
information is present, it amounts to one word per
word of program text or initialized 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 segment referred
to by the text or data word associated with the relocation
word:

.in +6
.ti -4
00  indicates the reference is absolute
.ti -4
02  indicates the reference is to the text segment
.ti -4
04  indicates the reference is to the data segment
.ti -4
06  indicates the reference is to the bss segment
.ti -4
10  indicates the reference is to an undefined external symbol.

.in -6
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 symbol (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.
.sp
.in 16
.ti 0
SEE ALSO	as__,
.ul
ld, strip, nm, un(I)