FILEHDR(5) BSD FILEHDR(5)
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; /* # symtab entries */
unsigned short f_opthdr; /* sizeof(opt hdr) */
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:
/* Apollo 68000-based machines */
#define APOLLOM68KMAGIC 0627
/* Apollo A88K-based machines */
#define APOLLOA88KMAGIC 0624
The value in f_timdat is obtained from the time(2) system call. Flag
bits currently defined are:
#define F_RELFLG 0000001 /* relocation info stripped */
#define F_EXEC 0000002 /* file is executable */
#define F_LNNO 0000004 /* line nunbers stripped */
#define F_LSYMS 0000010 /* local symbols stripped */
#define F_MINMAL 0000020 /* minimal object file (fextract) */
#define F_UPDATE 0000040 /* fully bound update file (ogen) */
#define F_SWABD 0000100 /* has had its bytes swabbed (in names) */
#define F_AR16WR 0000200 /* 16-bit DEC host */
#define F_AR32WR 0000400 /* 32-bit DEC host */
#define F_AR32W 0001000 /* non-DEC host */
#define F_PATCH 0002000 /* "patch" list in optional header */
#define F_NODF 0002000 /* (minimal file only) no decision functions */
/* for replaced functions */
#define F_BREAKPOINT 0020000 /* contains breakpoints inserted by debugger */
#define F_STRIPPED 0040000 /* stripped of unneeded symbols and strings */
#define F_PIC 0100000 /* contains position-independent code */
SEE ALSO
time(2), fseek(3S), a.out(5).