01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A.OUT ( 4) A.OUT ( 4)<br />

data segment and the text segment are not writable by the program;<br />

if other processes are executing the same a.out file, they<br />

will share a single text segment.<br />

Magic number 413 (octal) is the same as 410 (octal), except that<br />

413 (octal) permits demand paging. Both the -z and -F options<br />

of the loader ld(l) create a.out files with magic numbers 0413. If �<br />

the -z option is used, both the text and data sections of the file<br />

are on 1024-byte boundaries. If the -F option is used, the text<br />

and data sections of the file are contiguous. Loading a single<br />

4096-byte page into memory requires 4 transfers of 1024 bytes<br />

each for -z, and typically one transfer of 4096 bytes for -F.<br />

Thus a.out files created with -F can load faster and require less<br />

disk space.<br />

The stack begins at the end of memory and grows towards lower<br />

addresses. The stack is automatically extended as required. The<br />

data segment is extended only as requested by the brk (2) system<br />

call.<br />

The value of a word in the text or data portions that is not a<br />

reference to an undefined external symbol is exactly the value that<br />

will appear in memory when the file is executed. If a word in the<br />

text involves a reference to an undefined external symbol, the<br />

storage class of the symbol-table entry for that word will be<br />

marked as an "external symbol," and the section number will be<br />

set to 0. When the file is processed by the link editor and the<br />

external symbol becomes defined, the value of the symbol will be l<br />

added to the word in the file.<br />

File Header<br />

The format of the filehdr header is:<br />

struct filehdr<br />

{<br />

unsigned short f_magic; I* magic number *I<br />

unsigned short f_nscns; I* number of sections *I<br />

long f_timdat; I* time and date stamp *I<br />

long f_symptr; I* file ptr to symtab *I<br />

long f_nsyms; I* # symtab entries *I<br />

unsigned short f_opthdr; I* sizeof(opt hdr) *I<br />

unsigned short f_flags; I* flags *I<br />

};<br />

UNIX <strong>System</strong> Header<br />

The format of the UNIX system header is:<br />

typedef struct aouthdr<br />

{<br />

short magic; I* magic number *I<br />

short vstamp; I* version stamp *I<br />

long tsize; I* text size in bytes, padded *I<br />

long dsize; I* initialized data (.data) *I<br />

long bsize; I* uninitialized data {. bss) *I<br />

long entry; I* entry point *I<br />

long text_start; I* base of text used for this file *I<br />

long data_start; I* base of data used for this file *I<br />

- 2-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!