| (Relocatable) Object Module Format | |
|---|---|
| Filename extension | .omf,.obj |
| Developed by | Tool Interface Standards Committee |
| Type of format | Object file |
TheObject Module Format (OMF) is anobject fileformat used primarily for software intended to run onIntel 80x86microprocessors.It was originally developed byIntel around 1975–1977 forISIS-II, targeting the 8-bit8080/8085 processors.[1][2][3][4] This variant later became known asOMF-80.AsOMF-86 it was adapted to the 16-bit8086 processor in 1978.[5]
Version 4.0 of OMF for the 8086 family was released in 1981 under the nameRelocatable Object Module Format,[6][3][4] and is perhaps best known toDOS users as an.OBJ file. Versions for the80286 (OMF-286)[7][8] and the 32-bit80386 processors (OMF-386)[9][10][3] were introduced in 1981 and 1985, respectively.It has since been standardized by theTool Interface Standards Committee[11] and was also extended byMicrosoft[12] andIBM (IBM-OMF). Intel also adapted the format to the8051 microcontroller (OMF-51[13] andAOMF).
Many object file formats consist of a set of tables, such as the relocation table, which are either stored on fixed positions in the file, like thea.out format, or are pointed to by the header, like theELF format. The "sections", code, data area, etc., are stored as contiguous areas of bytes within such files.
The Relocatable Object Module Format, however, was designed to require minimal memory when linking, and consists of a series of records that have the following format:
| Size | Contents |
|---|---|
| 1 byte | Record type, for example relocation information |
| 2 bytes | Data length (N+1) |
| N bytes | Data (varies depending on the record type) |
| 1 byte | Checksum or 0 |
There is a wide variety of record types because of consolidation of OMF variants from several vendors, and because of adding such features as 32-bit code and dynamic linking. These are important record types:
DGROUPThere is no header containing file offsets, such as a pointer to a symbol table, in the file; alinker must completely parse the object file to extract all the information.
In the OMF format the data of one section is not necessarily stored as contiguous bytes in the file, instead itcan be represented by multiple records. The file format specification (version 1.1) says that thismust be done for sections larger than 1 KiB. Records containingrelocation information (fixups) must be stored immediately following the data records of the section they apply to, so the section data and the relocation information is "mixed" in the file.
The file format provides special records (LIDATA) that allow compression of repeating data sequences in an object file. It also provides the possibility to store the symbol name of the entry point of the later executable file in one object file.
The file format can also be used aslibrary file format.
The file format is the most important object file format under DOS, 16-bitWindows,and 16-bit and 32-bitOS/2.[14][15]
Few toolchains use the 32-bit version of the OMF format. For example, theWatcom C toolchain allows generating code for targets that use 32-bitsegmented memory layouts; Iron SpringPL/I can generate code for OS/2 32-bit flat memory layouts.
TheEmbarcadero Delphi compiler used this format when generatingobj files for C++. It was the only format of object files that could be linked to a program or unit written in Object Pascal prior to version XE2 of Delphi, which introduced support ofCOFF format, along with 64-bit Windows target.
A good friend of mine, Bruce, got the job of developing the Object Module Format (OMF) for the8080, and the upcoming8086. This piece of work would live on for years, sinceMS-DOS used it with little or no modifications […] It was a good piece of work and it was updated in 1985 to support the80386 32-bit flat address mode. […] The OMF gave us a good roadmap for the design of the linker, which knitted object modules together, and the locator, which processed therelocatable code into a fixed memory image, with a defined entry point, since that was howISIS handled load modules. The locator was also built to enable mapping of a linked module into a set ofEPROM images, so they could be programmed by aprom-burner.[1][2]