.TH A.OUT 5 "UNIX/32V" .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 VAX-11 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 text and data, 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. 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 512 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. .PP The stack will occupy the highest possible locations in the core image: growing downwards from 80000000(16). The stack is automatically extended as required. The data segment is only extended as requested by .IR break (2). .PP The start of the text segment in the file is 32(10); the start of the data segment is 32+a_text; the start of the text relocation is 32+a_text+a_data; the start of the data relocation is 32+a_text+a_data+a_trsize; the start of the symbol table is 32+a_text+a_data+a_trsize+a_drsize. .PP The layout of a symbol table entry and the principal flag values that distinguish symbol types are given in the include file. .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 byte in the text or data which is not a portion of a reference to an undefined external symbol is exactly that value which will appear in memory when the file is executed. If a byte in the text or data involves a reference to an undefined external symbol, as indicated by the relocation information, then the value 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 to the bytes in the file. .PP If relocation information is present, it amounts to six bytes per relocatable dataum. There is no relocation information if a_trsize+a_drsize==0. The relocation information is structured as .nf .ta 4n,+17n .PP struct relocation_info { long address; /* relative to current segment */ short pcrel:1, /* if so, segment offset has already */ /* been subtracted */ length:2, /* 0=byte, 1=word, 2=long */ extern:1, /* does not include value */ /* of symbol referenced */ offset:1, /* already includes origin */ /* of this segment (?) */ symbolnum:11; /* if extern then symbol table */ /* ordinal (0, 1, 2, ...) else */ /* segment number (same as symbol types) */ }; .fi .SH "SEE ALSO" as(1), ld(1), nm(1)