THEADR and LHEADR (0x80, 0x82)
Every module starts with one of these. The contents are a single name: usually the source file’s name for THEADR, or the module’s name in a library for LHEADR.
| Field | Meaning |
|---|---|
| Name | A count byte and the characters |
The name string is ASCII, always present; a null name is allowed but not recommended. It identifies the module within an object library or in linker messages, and is usually the name of the file with the source code (a path and file name, if supplied by the translator) or one set by the programmer (a TITLE or NAME directive). THEADR or LHEADR must be the first record; more than one header record is allowed (after an object bind, or when the source came from several files through include processing). LHEADR is handled identically to THEADR; it was defined in the original Intel 8086 specification with a different purpose, so its use for library modules is a Microsoft extension. Example: 80 09 00 07 68 65 6C 6C 6F 2E 63 CB is the module hello.c. The library file layout (Appendix 2 of the specification) is on the OMF library page.
LNAMES and LLNAMES (0x96, 0xCA)
Segments, groups and classes do not hold their own names. They refer to entries in a module-wide list of names, by index, and these records add to that list. LNAMES is used by SEGDEF and GRPDEF, and by COMDAT and CEXTDEF. LLNAMES marks local names, private to the module.
+0Name: a count byte and the charactersvaries…more names, to the end of the recordvaries
The names are numbered from 1 in the order they appear, across all the LNAMES and LLNAMES records of the module. An empty name is common: index 1 is often the empty string, used when a segment has no class.
Each name is a count byte and characters; a null name is valid; the character set is ASCII and a name can be up to 254 characters long. The names are used as segment, class, group, overlay (and for LLNAMES also COMDAT) and selector names. Names are numbered from 1 by occurrence across all LNAMES and LLNAMES records. An LNAMES or LLNAMES record must come before any record that refers to it, so it is usually near the start of the module. LLNAMES (added for Microsoft C 7.0) holds local names, and the specification says nothing more about the difference. The LNAMES record has not changed since the original Intel 8086 specification. Example: 96 25 00 00 04 43 4F 44 45 … begins with a null name and then CODE.
VERNUM and VENDEXT (0xCC, 0xCE)
VERNUM holds a version string (a count byte and characters) that tells which TIS-sponsored OMF version was generated. It has three numbers separated by periods: <TIS Version Base>.<Vendor Number>.<Version>. The base is the OMF base version given by the TIS Committee; the vendor number is assigned by TIS for vendor-specific extensions; the last is the vendor’s version. A vendor number or version of 0 is reserved for TIS, so 1.0.0 means a TIS-compliant OMF without vendor additions.
VENDEXT is the record for all vendor-specific extensions: a 2-byte vendor number (assigned by the TIS Committee; 0 is reserved) followed by the extension bytes to the end of the record. Their contents are not specified.