This header file defines a set of structures and symbols describing a.out-format object and executable files. Since the a.out format is extremely nonstandard and varies widely even across different operating systems for the same processor architecture, this header file only provides a minimal, ``least-common-denominator'' set of definitions that applies to all the a.out variants we know of. Therefore, actually interpreting a.out files requires considerably more information than is provided in this header file; for more information, see the source code for the OSKit's a.out interpreter, in exec/x86/aout.c.An a.out file contains a simple fixed-size header, represented by the following structure:
unsigned long a_magic; /* Magic number */ unsigned long a_text; /* Size of text segment */ unsigned long a_data; /* Size of initialized data */ unsigned long a_bss; /* Size of uninitialized data */ unsigned long a_syms; /* Size of symbol table */ unsigned long a_entry; /* Entry point */ unsigned long a_trsize; /* Size of text relocation */ unsigned long a_drsize; /* Size of data relocation */};The a_magic field typically contain one of the following traditional magic numbers:
- OMAGIC
- Used for relocatable object files (.o's).
- NMAGIC
- Originally used for executable files before demand-loading; current systems generally no longer use this.
- ZMAGIC
- This is the standard magic number for demand-loadable executable files; however, the exact meaning of this magic number varies from system to system.
- QMAGIC
- An alternate demand-loadable format, in which the a.out header itself is actually part of the text segment.
In addition, this header defines the nlist structure which describes the format of a.out symbol table entries:
long n_strx; /* Offset of symbol name in the string table */ unsigned char n_type; /* Symbol/relocation type */ char n_other; /* Miscellaneous info */ short n_desc; /* Miscellaneous info */ unsigned long n_value; /* Symbol value */};