man(1) Manual page archive

a.out(5) - Unix First Edition Manual Page
11/3/71A.OUT (V)

NAME a.out -- assembler and link editor output
SYNOPSIS
DESCRIPTION a.out is the output file of the assembler as and the linkeditor ld. In both cases, a.out is executable provided


there were no errors and no unresolved external references. This file has four sections: a header, the program text, asymbol table, and relocation bits. The last two may be empty if the program was loaded with the --s option of ld orif the symbols and relocation have been removed by strip.


The header always contains 6 words:


1 a "br .+14" instruction (205(8))2 The size of the program text 3 The size of the symbol table4 The size of the relocation bits area 5 The size of a data area6 A zero word (unused at present)


The sizes of the program, symbol table, and relocation areaare in bytes but are always even. The branch instruction serves both to identify the file and to jump to the textentry point. The program text size includes the 6--word header. The data area is used when the file is executed; the execsystem call sets the program break to the sum of the text size and this data size. The data area is generated by theassembler when the location counter "." lies beyond the last assembled data, for example when the program ends withone or more constructions of the form .=.+n ; it is preserved by the loader for the last program in a load.(Routines other than the last have the appropriate number of 0 words inserted, since there is no other provision forzero--suppression in an a.out file.)


The symbol table consists of 6--word entries. The first fourcontain the ASCII name of the symbol, null--padded. (In fact, the assembler generates symbols of at most 7 bytes.)The next word is a flag indicating the type of symbol. The following values are possible:00 undefined symbol


01 absolute symbol02 register symbol 03 relocatable symbol40 undefined global symbol 41 absolute global symbol


11/3/71A.OUT (v)



43 relocatable global symbol An undefined global corresponds to a GMAP "symref" and anabsolute or relocatable global to a "symdef" or absolute or relocatable value respectively. Values other than thosegiven above may occur if the user has defined some of his own instructions. The last word of a symbol table entry contains the value ofthe symbol. Its contents are not specified if the symbol is undefined. If a.out contains no unresolved global references, headerand text portions are exactly as they will appear in core when the file is executed. If the value of a word in thetext portion involves a reference to an undefined global, the word is replaced by the offset in the symbol table ofthe appropriate symbol. (That is, possible offsets are 0, 12(10), 24(10), ....) Such a word will have appropriaterelocation bits.


The relocation bits portion uses a variable--lengthencoding. There is a string of bits for each word in the text portion. The scheme has at least two bits for. eachword, plus possibly two more to extend the codes available; in either case the bits may be followed by a 16--bit stringto represent an offset to an external symbol. The bits are packed together without regard to word boundaries. The lastword is filled out with 0's on the right.


The possible relocation bit configurations are:


00 word is absolute


01 word is relocatable


10 word is a relative reference to an undefined global


symbol with no offset. Currently, the word contains theoffset in the symbol table of the symbol. When the symbol becomes defined, say with x, this location willcontain x--.--2, where "." is the location of the word.


1100xxxxxxxxxxxxxxxxword is a relative reference to an external symbol with


an offset. It is the same as the previous relocationtype, except that the 16--bit offset is added in when the symbol


11/3/71A.OUT (V)



becomes defined.


1101word is a reference to an undefined external symbol with no offset. At present the word contains thesymbol table offset of the symbol. When the symbol becomes defined, the word will contain the value ofthe symbol.


1110xxxxxxxxxxxxxxxxword is a reference to an undefined external symbol


with an offset. At present, the word contains thesymbol table offset of the symbol. When the symbol becomes defined, the word will contain the value ofthe symbol plus the given 16--bit offset.


FILES
SEE_ALSO as ld, strip, nm, un
DIAGNOSTICS
BUGS Soon, there will be a new type of symbol: the data areasymbol. In the text, it will appear as an ordinary external


reference. However, it need not be defined; this will bedone by the loader. Watch this space for more details.


OWNER dmr