Introduction
.obj is the extension for object files on DOS and Windows: the compiled
code of one source file, waiting for the linker to join it with others into a program or
library. Several formats have used it. Compilers and assemblers for 16-bit DOS and
Windows wrote Intel’s OMF format; 32-bit and 64-bit Windows compilers write COFF, the
object format that the Windows program formats,
PE32 and
PE32+, are built on. A very large COFF file uses
Microsoft’s bigobj form, and link-time code generation writes an anonymous header in
front of the compiler’s private data.
Unix-like systems use .o for the same job, in the
ELF or Mach-O
format, and cross-compilers such as the Espressif toolchain name their ELF output
.obj. A .obj file can also be something else entirely: a 3D
model in the Wavefront OBJ format, which is plain text.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.OBJ | OMF object file | Intel’s object format for 16-bit DOS and Windows compilers, in typed records. | Open |
.OBJ | COFF object file | Compiled code from Windows compilers, waiting for the linker. | Open |
.OBJ | COFF object file (bigobj) | The extended form of COFF, for objects with very many sections. | Open |
.OBJ | Anonymous object header | The wrapper Microsoft’s compiler writes for link-time code generation. | Open |
OMF object file
The Object Module Format, defined by Intel for the 8086 and used by most 16-bit DOS and Windows compilers and assemblers, such as Borland’s and early Microsoft tools. Some 32-bit compilers, such as Watcom’s, also used it. The file is a series of records, each with a type byte, a length and a checksum.
The file starts with a record type byte, almost always 0x80
(THEADR, the module name), followed by a 16-bit length and a short name string.
COFF object file
The Common Object File Format, written by Microsoft’s compiler in Visual Studio and by Clang and other compilers that target 32-bit and 64-bit Windows. It holds code and data in sections, with relocations and a symbol table.
The file has no signature. It starts with a 16-bit machine type, such as
4C 01 (0x14C, 32-bit x86) or 64 86
(0x8664, x64).
COFF object file (bigobj)
The extended form of COFF, for an object with more sections than the classic 16-bit
count allows. Microsoft’s compiler writes it with the /bigobj
option.
It starts with 00 00 FF FF, a version of 2 or more, a machine number
and a class identifier with the bytes
C7 A1 BA D1 EE BA A9 4B AF 20 FA F6 6A A4 DC B8.
Anonymous object header
What Microsoft’s compiler writes for a source file built with link-time code
generation, /GL. The header identifies the compiler’s private data; the
code is generated later, by the linker.
It starts with 00 00 FF FF, a version of 1 or more, and a class
identifier different from bigobj’s. A similar header with version 0 is a
short import object, a member of an import
library.
Not described
The explorer reads COFF, bigobj, anonymous COFF and OMF object files, and shows their tree with every byte accounted for.
Known, not yet covered
- Viewer: CodeView record contents are shown by kind only, and link-time code data is not read.
- Viewer: ELF object files are read only as far as the header and section list, and WebAssembly and LLVM bitcode objects are not read.
- Viewer: OMF vendor
COMENTclasses are not decoded, and the extended dictionary is not read. - Viewer: COFF relocations, symbols and member names were not confirmed against LLVM’s tools, because that comparison never finished.
- Viewer: bigobj files were tested only on files the site built; no real one was seen.
- Reference: the OMF pages were checked against the TIS Portable Formats Specification 1.10 (“Relocatable Object Module Format”, converted from its PDF) on 2026-11-19 and the records, fields, flags and rules of every record it defines were added. The extensions outside that document are now listed on the OMF overview with their sources (Open Watcom’s
pcobj.h, VirtualBox’somf.h, NASM’somfdump.c). Still not covered: the contents of Borland’s type and symbol comment classes, the data after each class 0xFE letter and the class 0xFD layout beyond scan tables, Phar Lap’s Easy OMF-386 document, COMFIX and SELDEF, the field layouts of Intel’s own 8086 records such as RHEADR and BLKDEF (Intel’s manual could not be fetched), and the library records of its Appendix 2, which belong to the OMF library page. - Reference: CodeView contents (
.debug$Sand.debug$Tsymbol and type records) are a separate format, specified in Microsoft’scvinfo.h; the COFF pages give only the section framing and the subsection kinds. - Reference: the optional header and the other image-only structures are in the PE32 pages, not here. The bigobj and anonymous-header fields at bytes 28 to 43 (Flags, MetaDataSize, MetaDataOffset) are named in headers but their meaning is undocumented in every source read.
Unknown
- Reference: the contents of the data after an anonymous (
/GL) object header are private to Microsoft’s tools; the sources tried were PE Format, LLVMCOFF.handCOFFObjectFile.cpp, the mingw-w64 and Winewinnt.h.
Also used for
- Wavefront OBJ – A plain text mesh of vertices, normals and faces, read by almost every 3D program.