Every COFF object file starts at offset 0 with the same 20-byte structure, which a PE
file has after its PE\0\0 signature. The file has no magic number, so the
first field, the machine type, is how a reader recognises one.
IMAGE_FILE_HEADER
0Machine: the processor2 bytes2NumberOfSections2 bytes4TimeDateStamp4 bytes8PointerToSymbolTable4 bytes12NumberOfSymbols4 bytes16SizeOfOptionalHeader: 0 in an object file2 bytes18Characteristics: flags2 bytes
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 2 | Machine | The processor the code is for; see Machine values. |
| 2 | 2 | NumberOfSections | How many entries the section table has; the table immediately follows the headers. The Windows loader limits an image to 96 sections (PE Format); an object file with more needs the bigobj header, whose count is 32-bit. |
| 4 | 4 | TimeDateStamp | The low 32 bits of the number of seconds since 1 January 1970. Indicates when the file was created. In a deterministic (reproducible) build the field holds part or all of a hash of the content and no longer a date; PE Format states this for images that carry an IMAGE_DEBUG_TYPE_REPRO debug entry. |
| 8 | 4 | PointerToSymbolTable | The file offset of the symbol table, or 0 when there is none. |
| 12 | 4 | NumberOfSymbols | How many 18-byte records the symbol table has, counting the auxiliary records. The string table starts immediately after the last record. |
| 16 | 2 | SizeOfOptionalHeader | Should be 0 in an object file. The optional header is required for images; an object file can have one, but it has no function there except to increase the header size (PE Format). A reader must use this size to find the section table, which follows the optional header. |
| 18 | 2 | Characteristics | Flags; see Characteristics. |
Machine values
| Value | Constant | Processor |
|---|---|---|
0x0 | IMAGE_FILE_MACHINE_UNKNOWN | The content is assumed to apply to any machine type |
0x184 | IMAGE_FILE_MACHINE_ALPHA | Alpha AXP, 32-bit address space |
0x284 | IMAGE_FILE_MACHINE_ALPHA64 (also named AXP64) | Alpha 64, 64-bit address space |
0x1D3 | IMAGE_FILE_MACHINE_AM33 | Matsushita AM33 |
0x8664 | IMAGE_FILE_MACHINE_AMD64 | x64 |
0x1C0 | IMAGE_FILE_MACHINE_ARM | ARM little-endian |
0xAA64 | IMAGE_FILE_MACHINE_ARM64 | ARM64 little-endian |
0xA641 | IMAGE_FILE_MACHINE_ARM64EC | The ABI that lets native ARM64 and emulated x64 code interoperate |
0xA64E | IMAGE_FILE_MACHINE_ARM64X | A binary format that lets native ARM64 and ARM64EC code coexist in one file |
0x1C4 | IMAGE_FILE_MACHINE_ARMNT | ARM Thumb-2 little-endian |
0xEBC | IMAGE_FILE_MACHINE_EBC | EFI byte code |
0x14C | IMAGE_FILE_MACHINE_I386 | Intel 386 or later and compatible processors |
0x200 | IMAGE_FILE_MACHINE_IA64 | Intel Itanium processor family |
0x6232 | IMAGE_FILE_MACHINE_LOONGARCH32 | LoongArch 32-bit |
0x6264 | IMAGE_FILE_MACHINE_LOONGARCH64 | LoongArch 64-bit |
0x9041 | IMAGE_FILE_MACHINE_M32R | Mitsubishi M32R little-endian |
0x266 | IMAGE_FILE_MACHINE_MIPS16 | MIPS16 |
0x366 | IMAGE_FILE_MACHINE_MIPSFPU | MIPS with FPU |
0x466 | IMAGE_FILE_MACHINE_MIPSFPU16 | MIPS16 with FPU |
0x1F0 | IMAGE_FILE_MACHINE_POWERPC | Power PC little-endian |
0x1F1 | IMAGE_FILE_MACHINE_POWERPCFP | Power PC with floating point support |
0x160 | IMAGE_FILE_MACHINE_R3000BE | MIPS I compatible, 32-bit big-endian |
0x162 | IMAGE_FILE_MACHINE_R3000 | MIPS I compatible, 32-bit little-endian |
0x166 | IMAGE_FILE_MACHINE_R4000 | MIPS III compatible, 64-bit little-endian |
0x168 | IMAGE_FILE_MACHINE_R10000 | MIPS IV compatible, 64-bit little-endian |
0x5032 | IMAGE_FILE_MACHINE_RISCV32 | RISC-V 32-bit address space |
0x5064 | IMAGE_FILE_MACHINE_RISCV64 | RISC-V 64-bit address space |
0x5128 | IMAGE_FILE_MACHINE_RISCV128 | RISC-V 128-bit address space |
0x1A2 | IMAGE_FILE_MACHINE_SH3 | Hitachi SH3 |
0x1A3 | IMAGE_FILE_MACHINE_SH3DSP | Hitachi SH3 DSP |
0x1A6 | IMAGE_FILE_MACHINE_SH4 | Hitachi SH4 |
0x1A8 | IMAGE_FILE_MACHINE_SH5 | Hitachi SH5 |
0x1C2 | IMAGE_FILE_MACHINE_THUMB | Thumb |
0x169 | IMAGE_FILE_MACHINE_WCEMIPSV2 | MIPS little-endian, Windows CE v2 |
This is the whole list in Microsoft’s PE Format specification (Machine Types). LLVM’s COFF.h (enum MachineTypes) defines the same values, except that it omits ALPHA, ALPHA64, LOONGARCH32/64, R3000BE, R3000 and R10000. A reader that meets another value should show it as unknown. Microsoft states that an image can run only on the specified machine or one that emulates it.
Characteristics
The specification defines these flags for both object and image files, but several apply to images only. Which of them a compiler sets in an object file is not stated by the specification; the explorer’s test files show object files that carry 0 or only a few of them (an observation, not a rule).
| Bit | Constant | Meaning (Microsoft’s wording, shortened) |
|---|---|---|
0x0001 | IMAGE_FILE_RELOCS_STRIPPED | Image only (Windows CE, Windows NT and later). No base relocations, so the image must load at its preferred base address; if that is not available the loader reports an error. The linker’s default is to strip base relocations from executables. |
0x0002 | IMAGE_FILE_EXECUTABLE_IMAGE | Image only. The image is valid and can be run; if it is not set, it indicates a linker error. |
0x0004 | IMAGE_FILE_LINE_NUMS_STRIPPED | COFF line numbers removed. Deprecated, should be zero. |
0x0008 | IMAGE_FILE_LOCAL_SYMS_STRIPPED | COFF symbol table entries for local symbols removed. Deprecated, should be zero. |
0x0010 | IMAGE_FILE_AGGRESSIVE_WS_TRIM | Obsolete: aggressively trim the working set. Deprecated for Windows 2000 and later, must be zero. |
0x0020 | IMAGE_FILE_LARGE_ADDRESS_AWARE | The application can handle addresses above 2 GB. |
0x0040 | (reserved) | Reserved for future use. |
0x0080 | IMAGE_FILE_BYTES_REVERSED_LO | Little-endian: the least significant bit precedes the most significant in memory. Deprecated, should be zero. |
0x0100 | IMAGE_FILE_32BIT_MACHINE | The machine is based on a 32-bit-word architecture. |
0x0200 | IMAGE_FILE_DEBUG_STRIPPED | Debugging information removed from the image file. |
0x0400 | IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP | If the image is on removable media, load it fully and copy it to the swap file. |
0x0800 | IMAGE_FILE_NET_RUN_FROM_SWAP | If the image is on network media, load it fully and copy it to the swap file. |
0x1000 | IMAGE_FILE_SYSTEM | A system file, not a user program. |
0x2000 | IMAGE_FILE_DLL | A dynamic-link library; treated as executable for almost all purposes although it cannot be run directly. |
0x4000 | IMAGE_FILE_UP_SYSTEM_ONLY | Run only on a uniprocessor machine. |
0x8000 | IMAGE_FILE_BYTES_REVERSED_HI | Big-endian: the most significant bit precedes the least. Deprecated, should be zero. |
Source: PE Format, Characteristics; LLVM COFF.h Characteristics defines the same bits (it has no name for 0x0040).