filehdr(4) — File Formats
Digital
NAME
filehdr − file header for object files
SYNOPSIS
#include < filehdr.h>
DESCRIPTION
Every object file begins with a 20-byte header. The following C struct declaration is used:
structfilehdr
{
unsigned shortf_magic;/∗ magic number ∗/
unsigned shortf_nscns;/∗ number of sections ∗/
longf_timdat;/∗ time & date stamp ∗/
longf_symptr;/∗ file pointer to symbolic header ∗/
longf_nsyms;/∗ sizeof(symbolic header) ∗/
unsigned shortf_opthdr;/∗ sizeof(optional header) ∗/
unsigned shortf_flags;/∗ flags ∗/
};
F_symptr is the byte offset into the file at which the symbolic header can be found. Its value can be used as the offset in fseek(3S) to position an I/O stream to the symbolic header. The optional header is 56-bytes. The valid magic numbers are given below:
#defineMIPSEBMAGIC0x0160/∗ objects for big-endian machines ∗/
#defineMIPSELMAGIC0x0162/∗ objects for little-endian machines ∗/
#defineMIPSEBUMAGIC0x0180/∗ ucode objects for big-endian machines ∗/
#defineMIPSELUMAGIC0x0182/∗ ucode objects for little-endian machines ∗/
Object files can be loaded and examined on machines differing from the object’s target byte sex. Therefore, for object file magic numbers, the byte swapped values have define constants associated with them:
#defineSMIPSEBMAGIC0x6001
#defineSMIPSELMAGIC0x6201
The value in f_timdat is obtained from the time(2) system call. Flag bits used in objects are:
#defineF_RELFLG0000001/∗ relocation entries stripped ∗/
#defineF_EXEC0000002/∗ file is executable ∗/
#defineF_LNNO0000004/∗ line numbers stripped ∗/
#defineF_LSYMS0000010/∗ local symbols stripped ∗/