Some sections are read by the linker rather than loaded by a program. They are told apart by their names and flags.
.drectve: linker directives
A section named .drectve with IMAGE_SCN_LNK_INFO set holds
linker options as text, ANSI unless it starts with the UTF-8 byte order mark
EF BB BF. The options are separated by spaces, and an option containing
spaces is enclosed in quotes. The section has no relocations or line numbers, and the
linker leaves it out of the program.
A typical one reads /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES": the
compiler telling the linker which runtime libraries to search.
CodeView debug sections
Microsoft’s tools write debug information in two sections of the CodeView format. Each starts with a 4-byte signature: 4 for the current form, CV_SIGNATURE_C13.
.debug$S: symbols and lines
After the signature come subsections, each padded to a multiple of 4 bytes:
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | Kind | What the subsection holds. Bit 31 set means ignore it. |
| 4 | 4 | Length | The size of the contents |
| 8 | Length | Contents |
| Kind | Name | Holds |
|---|---|---|
0xF1 | DEBUG_S_SYMBOLS | CodeView symbol records |
0xF2 | DEBUG_S_LINES | Line numbers |
0xF3 | DEBUG_S_STRINGTABLE | A string table for file names |
0xF4 | DEBUG_S_FILECHKSMS | File names and their checksums |
0xF5 | DEBUG_S_FRAMEDATA | Stack frame information |
0xF6 | DEBUG_S_INLINEELINES | Line numbers of inlined functions |
A symbol record in DEBUG_S_SYMBOLS has a 2-byte length that doesn’t count itself and a 2-byte kind, such as 0x1110 (S_GPROC32, a function), 0x1101 (S_OBJNAME) or 0x113C (S_COMPILE3).
.debug$T: types
After the signature come type records, each a 2-byte length and a 2-byte kind, such as
0x1505 (LF_STRUCTURE), 0x1008 (LF_PROCEDURE) or
0x1203 (LF_FIELDLIST). When a build writes a program database with
/Zi, this section may instead hold a single LF_TYPESERVER2
record that points to the PDB file.