A segment’s bytes are not stored in one place. A compiler usually writes them in several LEDATA records of up to about a kilobyte, each followed by the FIXUPP records for its data. A reader rebuilds the segment by placing each record’s bytes at its offset.
LEDATA (0xA0, 0xA1)
+0Segment index: an index into the SEGDEFsindex…Enumerated data offset: where this data starts in the segment2 or 4 bytes…Data: bytes for the segmentto the end of the record
LIDATA (0xA2, 0xA3)
Iterated data repeats a pattern without storing every copy. The record has a segment index and an offset, as in LEDATA, followed by iterated blocks to the end of the record.
| Field | Size | Meaning |
|---|---|---|
| Repeat count | 2 or 4 | How many times the block is repeated |
| Block count | 2 | 0 means data follows; otherwise this many nested blocks follow |
| Content | varies | If the block count is 0: a length byte and that many bytes. Otherwise: nested iterated blocks |
So 03 00, 00 00, 02, AA BB means three copies of the two bytes AA BB, six bytes in all.
COMDAT (0xC2, 0xC3)
A block of code or data the linker keeps one copy of, like a COFF COMDAT section. Comes in the two forms as usual.
| Field | Size | Meaning |
|---|---|---|
| Flags | 1 | Bit 0: continuation of the COMDAT before. Bit 1: iterated data (LIDATA form). Bit 2: local |
| Attributes | 1 | High nibble, selection: 0 no match, 1 pick any, 2 same size, 3 exact match. Low nibble, allocation: 0 explicit, 1 far code, 2 far data, 3 32-bit code, 4 32-bit data |
| Alignment | 1 | 0 from the SEGDEF, 1 byte, 2 word, 3 paragraph, 4 page, 5 double word |
| Enumerated data offset | 2 or 4 | Where this block goes within the COMDAT |
| Type index | index | Usually 0 |
| Base group, base segment | indexes | Only when the allocation is explicit; a base frame follows if both are 0 |
| Public name | index | The COMDAT’s symbol, an index into the LNAMES |
| Data | varies | The bytes, or iterated blocks if flag bit 1 is set |
BAKPAT and NBKPAT
BAKPAT (0xB2, 0xB3): a segment index and a location byte (0 byte, 1 word, 2 double word), then pairs of an offset and a value, each 2 or 4 bytes: the linker adds each value to the bytes at that offset. NBKPAT (0xC8, 0xC9) is the same with a location byte first and a public name index instead of a segment index, for a COMDAT.