filehdr(4) filehdr(4)
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 fmagic ; /* magic number */
unsigned short fnscns ; /* number of sections */
long ftimdat ; /* time & date stamp */
long fsymptr ; /* file ptr to symtab */
long fnsyms ; /* number of symtab entries */
unsigned short fopthdr ; /* sizeof(opt and header) */
unsigned short fflags ; /* flags */
};
fsymptr 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 Reliant UNIX system
optional header is 28 bytes. The valid magic numbers are given below:
#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 */
#define MIPSEBMAGIC 0x0160
#define MIPSELMAGIC 0x0162
#define SMIPSEBMAGIC 0x6001
#define SMIPSELMAGIC 0x6201
#define MIPSEBUMAGIC 0x0180
#define MIPSELUMAGIC 0x0182
The value in ftimdat is obtained from the time(2) system call. Flag
bits for f-flags currently defined are:
#define FRELFLG 0000001 /* relocation entries stripped */
#define FEXEC 0000002 /* file is executable */
#define FLNNO 0000004 /* line numbers stripped */
#define FLSYMS 0000010 /* local symbols stripped */
#define FMINIMAL 0000020
#define FUPDATE 0000040
#define FSWABD 0000100
#define FPATCH 0002000
#define FNODF 0002000
#define FCPIC 0004000
Page 1 Reliant UNIX 5.44 Printed 11/98
filehdr(4) filehdr(4)
#define FPIX 0010000
SEE ALSO
time(2), fseek(3S), a.out(4).
Page 2 Reliant UNIX 5.44 Printed 11/98