A.OUT(F) XENIX System V A.OUT(F)
Name
a.out - Format of assembler and link editor output.
Description
A.out is the output file of the assembler masm and the link
editor ld. Both programs will make a.out executable if
there were no errors in assembling or linking, and no
unresolved external references.
The format of a.out, called the x.out or segmented x.out
format, is defined by the files /usr/include/a.out.h and
/usr/include/sys/relsym.h. The a.out file has the following
general layout:
1. Header.
2. Extended header.
3. File segment table (for segmented formats).
4. Segments (Text, Data, Symbol, and Relocation).
In the segmented format, there may be several text and data
segments, depending on the memory model of the program.
Segments within the file begin on boundaries which are
multiplies of 512 bytes as defined by the file's pagesize.
Format
/*
* The main and extended header structures.
* For x.out segmented (XE_SEG):
* 1) fields marked with (s) must contain sums of xs_psize for
* non-memory images, or xs_vsize for memory images.
* 2) the contents of fields marked with (u) are undefined.
*/
struct xexec { /* x.out header */
unsigned short x_magic; /* magic number */
unsigned short x_ext; /* size of header extension */
long x_text; /* size of text segment (s) */
long x_data; /* size of initialized data (s) */
long x_bss; /* size of uninitialized data (s) */
long x_syms; /* size of symbol table (s) */
long x_reloc; /* relocation table length (s) */
long x_entry; /* entry point, machine dependent */
char x_cpu; /* cpu type & byte/word order */
char x_relsym; /* relocation & symbol format (u) */
unsigned short x_renv; /* run-time environment */
};
struct xext { /* x.out header extension */
Page 1 (printed 8/7/87)
A.OUT(F) XENIX System V A.OUT(F)
long xe_trsize; /* size of text relocation (s) */
long xe_drsize; /* size of data relocation (s) */
long xe_tbase; /* text relocation base (u) */
long xe_dbase; /* data relocation base (u) */
long xe_stksize; /* stack size (if XE_FS set) */
/* the following must be present if XE_SEG */
long xe_segpos; /* segment table position */
long xe_segsize; /* segment table size */
long xe_mdtpos; /* machine dependent table position */
long xe_mdtsize; /* machine dependent table size */
char xe_mdttype; /* machine dependent table type */
char xe_pagesize; /* file pagesize, in multiples of 512 */
char xe_ostype; /* operating system type */
char xe_osvers; /* operating system version */
unsigned short xe_eseg; /* entry segment, machine dependent */
unsigned short xe_sres; /* reserved */
};
struct xseg { /* x.out segment table entry */
unsigned short xs_type; /* segment type */
unsigned short xs_attr; /* segment attributes */
unsigned short xs_seg; /* segment number */
char xs_align; /* log base 2 of alignment */
char xs_cres; /* unused */
long xs_filpos; /* file position */
long xs_psize; /* physical size (in file) */
long xs_vsize; /* virtual size (in core) */
long xs_rbase; /* relocation base address/offset */
unsigned short xs_noff; /* segment name string table offset */
unsigned short xs_sres; /* unused */
long xs_lres; /* unused */
};
struct xiter { /* x.out iteration record */
long xi_size; /* source byte count */
long xi_rep; /* replication count */
long xi_offset; /* destination offset in segment */
};
struct xlist { /* xlist structure for xlist(3). */
unsigned short xl_type; /* symbol type */
unsigned short xl_seg; /* file segment table index */
long xl_value; /* symbol value */
char *xl_name; /* pointer to asciz name */
};
struct aexec { /* a.out header */
unsigned short xa_magic; /* magic number */
unsigned short xa_text; /* size of text segment */
unsigned short xa_data; /* size of initialized data */
Page 2 (printed 8/7/87)
A.OUT(F) XENIX System V A.OUT(F)
unsigned short xa_bss; /* size of unitialized data */
unsigned short xa_syms; /* size of symbol table */
unsigned short xa_entry; /* entry point */
unsigned short xa_unused; /* not used */
unsigned short xa_flag; /* relocation info stripped */
};
struct nlist { /* nlist structure for nlist(3). */
char n_name[8]; /* symbol name */
int n_type; /* type flag */
unsigned n_value; /* value */
};
struct bexec { /* b.out header */
long xb_magic; /* magic number */
long xb_text; /* text segment size */
long xb_data; /* data segment size */
long xb_bss; /* bss size */
long xb_syms; /* symbol table size */
long xb_trsize; /* text relocation table size */
long xb_drsize; /* data relocation table size */
long xb_entry; /* entry point */
};
See Also
masm(CP), ld(CP), nm(CP), strip(CP), xlist(S).
Page 3 (printed 8/7/87)