V7M/man/man5/a.out.5

Compare this file to the similar file:
Show the results in this format:

.TH A.OUT 5 
.SH NAME
a.out \- assembler and link editor output
.SH SYNOPSIS
.B #include <a.out.h>
.SH DESCRIPTION
.I A.out
is the output file of the assembler
.IR as (1)
and the link editor
.IR ld (1).
Both programs make
.I a.out
executable if there were no
errors and no unresolved external references.
Layout information as given in the include file for the PDP11 is:
.PP
.nf
.ta 8n +9n +11n
.PP
.so /usr/include/a.out.h
.fi
.PP
The file has four sections:
a header, the program and data text,
relocation information, and a symbol table
(in that order).
The last two may be empty
if the program was loaded
with the `\-s' option
of
.I ld
or if the symbols and relocation have been
removed by
.IR strip (1).
.PP
In the header the sizes of each section are given in bytes, but are even.
The size of the header is not included in any of the other sizes.
.PP
When an
.I a.out
file is loaded into core for execution, three logical segments are
set up: the text segment, the data segment
(with uninitialized data, which starts off as all 0, following
initialized),
and a stack.
The text segment begins at 0
in the core image; the header is not loaded.
If the magic number in the header is 0407(8), it indicates that the text
segment is not to be write-protected and shared,
so the data segment is immediately contiguous
with the text segment.
If the magic number is 0410,
the data segment begins at the first 0 mod 8K byte
boundary following the text segment,
and the text segment is not writable by the program;
if other processes are executing the same file,
they will share the text segment.
If the magic number is 411,
the text segment is again pure, write-protected, and shared,
and moreover instruction and data space are separated;
the text and data segment both begin at location 0.
If the magic number is 0405, the text segment
is overlaid on an existing (0411 or 0405) text segment
and the existing data segment is preserved.
.PP
The stack will occupy the highest possible locations
in the core image: from 0177776(8) and growing downwards.
The stack is automatically extended as required.
The data segment is only extended as requested by
.IR brk (2).
.PP
The start of the text segment in the file is 020(8);
the start of the data segment is 020+S\s6\dt\u\s10 (the size of the text)
the start of the relocation information is
020+S\s6\dt\u\s10+S\s6\dd\u\s10;
the start of the symbol table is
020+2(S\s6\dt\u\s10+S\s6\dd\u\s10)
if the
relocation information is present,
020+S\s6\dt\u\s10+S\s6\dd\u\s10
if not.
.PP
The layout of a symbol table entry and the principal flag values
that distinguish symbol types are given in the include file.
Other flag values may occur if an assembly language program
defines machine instructions.
.PP
If a symbol's type is undefined external,
and the value field is non-zero,
the symbol is interpreted by the loader
.I ld
as
the name of a common region
whose size is indicated by the value of the
symbol.
.PP
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 information
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.
.PP
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 `relocation info stripped'
flag in the header is on.
.PP
Bits 3-1 of a relocation word indicate the segment referred
to by the text or data word associated with the relocation
word:
.TP
000
absolute number
.br
.ns
.TP
002
reference to text segment
.br
.ns
.TP
004
reference to initialized data
.br
.ns
.TP
006
reference to uninitialized data (bss)
.br
.ns
.TP
010
reference to undefined external symbol
.PP
Bit 0 of the relocation word indicates, if 1,
that the
reference is relative to the pc (e.g. `clr x');
if 0,
that
the reference is to the actual symbol (e.g.,
`clr *$x').
.PP
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.
.SH "SEE ALSO"
as(1), ld(1), nm(1)