StupidOS/docs/COFF.org
d0p1 🏳️‍⚧️ a4d5179982
Some checks failed
Build / test (push) Has been cancelled
Docs / test (push) Has been cancelled
doc: describe COFF file structure
2024-03-21 13:18:23 +01:00

2.5 KiB

Common Object File Format (COFF)

COFF File Structure

         +-----------------------+
         |                       |
         | File Header           |
         |                       |
         +-----------------------+----
         |                       |    \
         | Optional File Header  |    | Only for executable file
         |    (a.out header)     |    /
         +-----------------------+----
         |                       |    \
         | Section Header 1      |    |
         |                       |    |
         +-----------------------+    |
         .                       .    | Section Headers
         .                       .    |
         +-----------------------+    |
         |                       |    |
         | Section Header n      |    |
         |                       |    /
         +-----------------------+----
         |                       |    \
         | Section 1 Raw Data    |    |
         |                       |    |
         +-----------------------+    |
         .                       .    | Raw data
         .                       .    | (Executable Code and Initialized Data)
         +-----------------------+    |
         |                       |    |
         | Section n Raw Data    |    |
         |                       |    /
         +-----------------------+----
         |                       |    \
         | Section 1 Relocation  |    |
         |      Information      |    |
         +-----------------------+    |
         .                       .    | Relocation
         .                       .    | Information
         +-----------------------+    |
         |                       |    |
         | Section n Relocation  |    |
         |      Information      |    /
         +-----------------------+----
         |                       |
         | Symbol Table          |
         |                       |
         +-----------------------+
         |                       |
         | String Table          |
         |                       |
         +-----------------------+

File Header

Type Description
uint16_t Version ID (0x014c for i386)
uint16_t Number of section headers
uint32_t Timestamp
uint32_t Symtab address
uint32_t Number of entries in the symtab
uint16_t Optional header size
uint16_t Flags