delorie.com/djgpp/doc/coff/   search  
DJGPP COFF Spec

This document should be considered to be the ultimate reference to the DJGPP COFF format. That doesn't mean it's complete, but since this format isn't really documented elsewhere, this is as good as it gets. All programs reading COFF files should include <coff.h>

Note: Unless otherwise specified, all numeric fields are stored in host native order, which is LSB-first (little endian) for DJGPP, and all file offsets are relative to the beginning of the COFF object (i.e. the file header is always at offset zero, even when the object is inside a library).

Comments to dj@delorie.com

Structure Located? Purpose
File Header Beginning of file Overview of the file; controls layout of other sections
Optional Header Follows file header For executables, used to store the initial %eip
Section Header Follow optional header; count determined by file header Maintain location and size information about code and data sections
Section Data Stored in section header Contains code and data for the program
Relocation Directives Stored in section header Contain fixup information needed when relocating a section
Line Numbers Stored in section header Hold address of each line number in code/data sections
Symbol Table Stored in file header Contains one entry for each symbol this file defines or references
String Table Follows symbol table Stores symbol names; first four bytes are total length

  webmaster     delorie software   privacy  
  Copyright © 1996     Updated Oct 1996