[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    filehdr(4) manual page Table of Contents

Name

filehdr - file header for common object files

Synopsis

#include <filehdr.h>

Description

Every common object file begins with a 20-byte header. The following C struct declaration is used:


struct  filehdr
{
    unsigned short    f_magic ;    /* magic number */
    unsigned short    f_nscns ;    /* number of sections */
    long        f_timdat ;    /* time & date stamp */
    long        f_symptr ;    /* file ptr to symtab */
    long        f_nsyms ;    /* number of symtab entries */
    unsigned short    f_opthdr ;    /* sizeof(opt and header) */
    unsigned short    f_flags ;    /* flags */
};

f_symptr is the byte offset into the file at which the symbol table can be found. Its value can be used as the offset in fseek(3S) to position an I/O stream to the symbol table. The UNIX system optional header is 28 bytes. The valid magic numbers are given below:

#defineI386MAGIC0514/* i386 Computer */
#defineWE32MAGIC0560/* 3B2, 3B5, and 3B15 computers */
#defineN3BMAGIC0550/* 3B20 computer */
#defineNTVMAGIC0551/* 3B20 computer */
#defineVAXWRMAGIC0570/* VAX writable text segments */
#defineVAXROMAGIC0575/* VAX read only sharable
text segments */

The value in f_timdat is obtained from the time(2) system call. Flag bits currently defined are:


#defineF_RELFLG0000001/* relocation entries stripped */
#defineF_EXEC0000002/* file is executable */
#defineF_LNNO0000004/* line numbers stripped */
#defineF_LSYMS0000010/* local symbols stripped */
#defineF_AR16WR0000200/* 16-bit DEC host */
#defineF_AR32WR0000400/* 32-bit DEC host */
#defineF_AR32W0001000/* non-DEC host */
#defineF_BM32ID0160000/* WE32000 family ID field */
#defineF_BM32B0020000/* file contains WE 32100 code */
#defineF_BM32MAU0040000/* file reqs MAU to execute */
#defineF_BM32RST0010000/* this object file contains restore
work around [3B5/3B2 only] */

See Also

time(2) , fseek(3S) , a.out(4)


Table of Contents