coff.h File Reference

Go to the source code of this file.

Data Structures

struct  COFF_AOUTHDR
 ********************* AOUT "OPTIONAL HEADER" ********************* More...
struct  COFF_scnhdr
 ********************* SECTION HEADER ********************* More...
struct  COFF_slib
struct  COFF_lineno
 ********************* LINE NUMBERS ********************* More...
struct  COFF_syment
union  COFF_auxent
struct  COFF_reloc
 ********************* RELOCATION DIRECTIVES ********************* More...

Defines

#define E_SYMNMLEN   8
 Number of characters in a symbol name.
#define E_FILNMLEN   14
 Number of characters in a file name.
#define E_DIMNUM   4
 Number of array dimensions in auxiliary entry.
#define COFF_SHORT_L(ps)
 Load a short int from the following tables with little-endian formats.
#define COFF_LONG_L(ps)
 Load a long int from the following tables with little-endian formats.
#define COFF_SHORT_H(ps)
 Load a short int from the following tables with big-endian formats.
#define COFF_LONG_H(ps)
 Load a long int from the following tables with big-endian formats.
#define COFF_LONG(v)   COFF_LONG_L(v)
#define COFF_SHORT(v)   COFF_SHORT_L(v)
#define COFF_F_RELFLG   0000001
#define COFF_F_EXEC   0000002
#define COFF_F_LNNO   0000004
#define COFF_F_LSYMS   0000010
#define COFF_F_MINMAL   0000020
#define COFF_F_UPDATE   0000040
#define COFF_F_SWABD   0000100
#define COFF_F_AR16WR   0000200
#define COFF_F_AR32WR   0000400
#define COFF_F_AR32W   0001000
#define COFF_F_PATCH   0002000
#define COFF_F_NODF   0002000
#define COFF_I386MAGIC   0x14c
 Linux's system Perhaps, someday, these formats may be used.
#define COFF_I386BADMAG(x)   (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
#define COFF_FILHDR   struct COFF_filehdr
#define COFF_FILHSZ   sizeof(COFF_FILHDR)
#define COFF_AOUTSZ   (sizeof(COFF_AOUTHDR))
#define COFF_STMAGIC   0401
#define COFF_OMAGIC   0404
#define COFF_JMAGIC   0407
 dirty text and data image, can't share
#define COFF_DMAGIC   0410
 dirty text segment, data aligned
#define COFF_ZMAGIC   0413
 The proper magic number for executabls.
#define COFF_SHMAGIC   0443
 shared library header
#define COFF_SCNHDR   struct COFF_scnhdr
#define COFF_SCNHSZ   sizeof(COFF_SCNHDR)
#define COFF_TEXT   ".text"
#define COFF_DATA   ".data"
#define COFF_BSS   ".bss"
#define COFF_COMMENT   ".comment"
#define COFF_LIB   ".lib"
#define COFF_SECT_TEXT   0
 Section for instruction code.
#define COFF_SECT_DATA   1
 Section for initialized globals.
#define COFF_SECT_BSS   2
 Section for un-initialized globals.
#define COFF_SECT_REQD   3
 Minimum number of sections for good file.
#define COFF_STYP_REG   0x00
 regular segment
#define COFF_STYP_DSECT   0x01
 dummy segment
#define COFF_STYP_NOLOAD   0x02
 no-load segment
#define COFF_STYP_GROUP   0x04
 group segment
#define COFF_STYP_PAD   0x08
 .pad segment
#define COFF_STYP_COPY   0x10
 copy section
#define COFF_STYP_TEXT   0x20
 .text segment
#define COFF_STYP_DATA   0x40
 .data segment
#define COFF_STYP_BSS   0x80
 .bss segment
#define COFF_STYP_INFO   0x200
 .comment section
#define COFF_STYP_OVER   0x400
 overlay section
#define COFF_STYP_LIB   0x800
 library section
#define COFF_SLIBHD   struct COFF_slib
#define COFF_SLIBSZ   sizeof(COFF_SLIBHD)
#define COFF_LINENO   struct COFF_lineno
#define COFF_LINESZ   6
#define COFF_E_SYMNMLEN   8
 ********************* SYMBOLS ********************* # characters in a short symbol name
#define COFF_E_FILNMLEN   14
 # characters in a file name
#define COFF_E_DIMNUM   4
 # array dimensions in auxiliary entry
#define COFF_N_BTMASK   (0xf)
 Mask for important class bits.
#define COFF_N_TMASK   (0x30)
 Mask for important type bits.
#define COFF_N_BTSHFT   (4)
 # bits to shift class field
#define COFF_N_TSHIFT   (2)
 # bits to shift type field
#define COFF_SYMENT   struct COFF_syment
#define COFF_SYMESZ   18
#define COFF_AUXENT   union COFF_auxent
#define COFF_AUXESZ   18
#define COFF_ETEXT   "etext"
#define COFF_RELOC   struct COFF_reloc
#define COFF_RELSZ   10
#define COFF_DEF_DATA_SECTION_ALIGNMENT   4
#define COFF_DEF_BSS_SECTION_ALIGNMENT   4
#define COFF_DEF_TEXT_SECTION_ALIGNMENT   4
#define COFF_DEF_SECTION_ALIGNMENT   4
 For new sections we havn't heard of before.


Define Documentation

#define COFF_AOUTSZ   (sizeof(COFF_AOUTHDR))

Definition at line 162 of file coff.h.

#define COFF_AUXENT   union COFF_auxent

Definition at line 386 of file coff.h.

#define COFF_AUXESZ   18

Definition at line 387 of file coff.h.

#define COFF_BSS   ".bss"

Definition at line 199 of file coff.h.

#define COFF_COMMENT   ".comment"

Definition at line 200 of file coff.h.

#define COFF_DATA   ".data"

Definition at line 198 of file coff.h.

#define COFF_DEF_BSS_SECTION_ALIGNMENT   4

Definition at line 403 of file coff.h.

#define COFF_DEF_DATA_SECTION_ALIGNMENT   4

Definition at line 402 of file coff.h.

#define COFF_DEF_SECTION_ALIGNMENT   4

For new sections we havn't heard of before.

Definition at line 407 of file coff.h.

#define COFF_DEF_TEXT_SECTION_ALIGNMENT   4

Definition at line 404 of file coff.h.

#define COFF_DMAGIC   0410

dirty text segment, data aligned

Definition at line 167 of file coff.h.

#define COFF_E_DIMNUM   4

# array dimensions in auxiliary entry

Definition at line 265 of file coff.h.

#define COFF_E_FILNMLEN   14

# characters in a file name

Definition at line 264 of file coff.h.

#define COFF_E_SYMNMLEN   8

********************* SYMBOLS ********************* # characters in a short symbol name

Definition at line 263 of file coff.h.

#define COFF_ETEXT   "etext"

Definition at line 389 of file coff.h.

#define COFF_F_AR16WR   0000200

Definition at line 111 of file coff.h.

#define COFF_F_AR32W   0001000

Definition at line 113 of file coff.h.

#define COFF_F_AR32WR   0000400

Definition at line 112 of file coff.h.

#define COFF_F_EXEC   0000002

Definition at line 105 of file coff.h.

#define COFF_F_LNNO   0000004

Definition at line 106 of file coff.h.

#define COFF_F_LSYMS   0000010

Definition at line 107 of file coff.h.

#define COFF_F_MINMAL   0000020

Definition at line 108 of file coff.h.

#define COFF_F_NODF   0002000

Definition at line 115 of file coff.h.

#define COFF_F_PATCH   0002000

Definition at line 114 of file coff.h.

#define COFF_F_RELFLG   0000001

coff information for Intel 386/486.

/********************* FILE HEADER *********************

struct COFF_filehdr { char f_magic[2]; ///< magic number char f_nscns[2]; ///< number of sections char f_timdat[4]; ///< time & date stamp char f_symptr[4]; ///< file pointer to symtab char f_nsyms[4]; ///< number of symtab entries char f_opthdr[2]; ///< sizeof(optional hdr) char f_flags[2]; ///< flags };

/**

Bits for f_flags:

F_RELFLG relocation info stripped from file F_EXEC file is executable (i.e. no unresolved externel references) F_LNNO line nunbers stripped from file F_LSYMS local symbols stripped from file F_MINMAL this is a minimal object file (".m") output of fextract F_UPDATE this is a fully bound update file, output of ogen F_SWABD this file has had its bytes swabbed (in names) F_AR16WR this file has the byte ordering of an AR16WR (e.g. 11/70) machine F_AR32WR this file has the byte ordering of an AR32WR machine (e.g. vax and iNTEL 386) F_AR32W this file has the byte ordering of an AR32W machine (e.g. 3b,maxi) F_PATCH file contains "patch" list in optional header F_NODF (minimal file only) no decision functions for replaced functions

Definition at line 104 of file coff.h.

#define COFF_F_SWABD   0000100

Definition at line 110 of file coff.h.

#define COFF_F_UPDATE   0000040

Definition at line 109 of file coff.h.

#define COFF_FILHDR   struct COFF_filehdr

Definition at line 129 of file coff.h.

#define COFF_FILHSZ   sizeof(COFF_FILHDR)

Definition at line 130 of file coff.h.

#define COFF_I386BADMAG (  )     (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)

Definition at line 126 of file coff.h.

#define COFF_I386MAGIC   0x14c

Linux's system Perhaps, someday, these formats may be used.

Definition at line 117 of file coff.h.

#define COFF_JMAGIC   0407

dirty text and data image, can't share

Definition at line 166 of file coff.h.

#define COFF_LIB   ".lib"

Definition at line 201 of file coff.h.

#define COFF_LINENO   struct COFF_lineno

Definition at line 258 of file coff.h.

#define COFF_LINESZ   6

Definition at line 259 of file coff.h.

#define COFF_LONG (  )     COFF_LONG_L(v)

These may be overriden later by brain dead implementations which generate a big-endian header with little-endian data. In that case, generate a replacement macro which tests a flag and uses either of the two above

Definition at line 61 of file coff.h.

#define COFF_LONG_H ( ps   ) 

Value:

(((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
                                 ((unsigned long)((unsigned char)ps[1])<<16) |\
                                 ((unsigned long)((unsigned char)ps[2])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[3])))))
Load a long int from the following tables with big-endian formats.

Definition at line 47 of file coff.h.

#define COFF_LONG_L ( ps   ) 

Value:

(((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
                                 ((unsigned long)((unsigned char)ps[2])<<16) |\
                                 ((unsigned long)((unsigned char)ps[1])<<8)  |\
                                 ((unsigned long)((unsigned char)ps[0])))))
Load a long int from the following tables with little-endian formats.

Definition at line 37 of file coff.h.

#define COFF_N_BTMASK   (0xf)

Mask for important class bits.

Definition at line 292 of file coff.h.

#define COFF_N_BTSHFT   (4)

# bits to shift class field

Definition at line 294 of file coff.h.

#define COFF_N_TMASK   (0x30)

Mask for important type bits.

Definition at line 293 of file coff.h.

#define COFF_N_TSHIFT   (2)

# bits to shift type field

Definition at line 295 of file coff.h.

#define COFF_OMAGIC   0404

Definition at line 165 of file coff.h.

#define COFF_RELOC   struct COFF_reloc

Definition at line 399 of file coff.h.

#define COFF_RELSZ   10

Definition at line 400 of file coff.h.

#define COFF_SCNHDR   struct COFF_scnhdr

Definition at line 186 of file coff.h.

#define COFF_SCNHSZ   sizeof(COFF_SCNHDR)

Definition at line 187 of file coff.h.

#define COFF_SECT_BSS   2

Section for un-initialized globals.

Definition at line 205 of file coff.h.

#define COFF_SECT_DATA   1

Section for initialized globals.

Definition at line 204 of file coff.h.

#define COFF_SECT_REQD   3

Minimum number of sections for good file.

Definition at line 206 of file coff.h.

#define COFF_SECT_TEXT   0

Section for instruction code.

Definition at line 203 of file coff.h.

#define COFF_SHMAGIC   0443

shared library header

Definition at line 169 of file coff.h.

#define COFF_SHORT (  )     COFF_SHORT_L(v)

Definition at line 62 of file coff.h.

#define COFF_SHORT_H ( ps   ) 

Value:

((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
                                  ((unsigned short)((unsigned char)ps[1]))))
Load a short int from the following tables with big-endian formats.

Definition at line 43 of file coff.h.

#define COFF_SHORT_L ( ps   ) 

Value:

((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
                                  ((unsigned short)((unsigned char)ps[0]))))
Load a short int from the following tables with little-endian formats.

These defines are byte order independant. There is no alignment of fields permitted in the structures. Therefore they are declared as characters and the values loaded from the character positions. It also makes it nice to have it "endian" independant.

Definition at line 33 of file coff.h.

#define COFF_SLIBHD   struct COFF_slib

Definition at line 235 of file coff.h.

#define COFF_SLIBSZ   sizeof(COFF_SLIBHD)

Definition at line 236 of file coff.h.

#define COFF_STMAGIC   0401

Definition at line 164 of file coff.h.

#define COFF_STYP_BSS   0x80

.bss segment

Definition at line 216 of file coff.h.

#define COFF_STYP_COPY   0x10

copy section

Definition at line 213 of file coff.h.

#define COFF_STYP_DATA   0x40

.data segment

Definition at line 215 of file coff.h.

#define COFF_STYP_DSECT   0x01

dummy segment

Definition at line 209 of file coff.h.

#define COFF_STYP_GROUP   0x04

group segment

Definition at line 211 of file coff.h.

#define COFF_STYP_INFO   0x200

.comment section

Definition at line 217 of file coff.h.

#define COFF_STYP_LIB   0x800

library section

Definition at line 219 of file coff.h.

#define COFF_STYP_NOLOAD   0x02

no-load segment

Definition at line 210 of file coff.h.

#define COFF_STYP_OVER   0x400

overlay section

Definition at line 218 of file coff.h.

#define COFF_STYP_PAD   0x08

.pad segment

Definition at line 212 of file coff.h.

#define COFF_STYP_REG   0x00

regular segment

Definition at line 208 of file coff.h.

#define COFF_STYP_TEXT   0x20

.text segment

Definition at line 214 of file coff.h.

#define COFF_SYMENT   struct COFF_syment

Definition at line 384 of file coff.h.

#define COFF_SYMESZ   18

Definition at line 385 of file coff.h.

#define COFF_TEXT   ".text"

names of "special" sections

Definition at line 197 of file coff.h.

#define COFF_ZMAGIC   0413

The proper magic number for executabls.

Definition at line 168 of file coff.h.

#define E_DIMNUM   4

Number of array dimensions in auxiliary entry.

Definition at line 19 of file coff.h.

#define E_FILNMLEN   14

Number of characters in a file name.

Definition at line 18 of file coff.h.

#define E_SYMNMLEN   8

Number of characters in a symbol name.

This file is derrived from the GAS 2.1.4 assembler control file. The GAS product is under the GNU Public License, version 2 or later. As such, this file is also uder that license.

If the file format changes in the COFF object, this file should be subsequently updated to reflect the changes.

The actual loader module only uses a few of these structures. The full set is documented here because I received the full set. If you wish more information about COFF, then O'Rielly has a very excellent book.

Definition at line 17 of file coff.h.


Generated on Mon May 1 21:47:00 2006 for KernelAPI by  doxygen 1.4.6-5