filehdr(4) — FILE FORMATS
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 shortf_magic ;/∗ magic number ∗/
unsigned shortf_nscns ;/∗ number of sections ∗/
longf_timdat ;/∗ time & date stamp ∗/
longf_symptr ;/∗ file ptr to symtab ∗/
longf_nsyms ;/∗ number of symtab entries ∗/
unsigned shortf_opthdr ;/∗ sizeof(opt and header) ∗/
unsigned shortf_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:
| #define | MC68MAGIC | 0520 | /∗ M68000 family of processors ∗/ |
| #define | MC88MAGIC | 0555 | /∗ M88000 family of processors ∗/ |
| #define | I386MAGIC | 0514 | /∗ i386 Computer ∗/ |
| #define | WE32MAGIC | 0560 | /∗ 3B2, 3B5, and 3B15 computers ∗/ |
| #define | N3BMAGIC | 0550 | /∗ 3B20 computer ∗/ |
| #define | NTVMAGIC | 0551 | /∗ 3B20 computer ∗/ |
| #define | VAXWRMAGIC | 0570 | /∗ VAX writable text segments ∗/ |
| #define | VAXROMAGIC | 0575 | /∗ 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_RELFLG 0000001 /∗ relocation entries stripped ∗/
#defineF_EXEC0000002 /∗ file is executable ∗/
#defineF_LNNO0000004 /∗ line numbers stripped ∗/
#defineF_LSYMS 0000010 /∗ local symbols stripped ∗/
#defineF_AR16WR 0000200 /∗ 16-bit DEC host ∗/
#defineF_AR32WR 0000400 /∗ 32-bit DEC host ∗/
#defineF_AR32W 0001000 /∗ non-DEC host ∗/
#defineF_BM32ID 0160000 /∗ WE32000 family ID field ∗/
#defineF_BM32B 0020000 /∗ file contains WE 32100 code ∗/
#defineF_BM32MAU 0040000 /∗ file reqs MAU to execute ∗/
#defineF_BM32RST 0010000 /∗ file contains restore
work around [3B5/3B2 only] ∗/