17.01.2015 Views

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

Relocatable Object Module Format (OMF) Specification

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Relocatable</strong> <strong>Object</strong> <strong>Module</strong> <strong>Format</strong><br />

The record's Type field contains F1H (241 decimal), and its Record Length field is set so that the dictionary<br />

begins on a 512-byte boundary. The record contains no further useful information; the remaining bytes are<br />

insignificant. As with the library header, the last byte is not a checksum.<br />

Dictionary<br />

The remaining blocks in the library compose the dictionary. The number of blocks in the dictionary is given in the<br />

library header. The dictionary provides rapid searching for a name using a two-level hashing scheme.<br />

Due to the hashing algorithm, the number of dictionary blocks must be a prime number, and within each block is a<br />

prime number of buckets. Whereas a librarian can choose the prime number less than 255 for the dictionary<br />

blocks, the number of buckets within a block is fixed at 37.<br />

To search for a name within the blocks, two hashing indices and two hash deltas are computed. A block index<br />

and block delta controls how to go from one block to the other, and a bucket index and bucket delta controls how<br />

to search buckets within a block. Each bucket within a block corresponds to a single string.<br />

A block is 512 bytes long and the first 37 bytes correspond to the 37 buckets. To find the string corresponding to a<br />

bucket, multiply the value stored in the byte by two and use that as an index into the block. At this location in the<br />

block lies an unsigned byte value for the string length, followed by the string characters (not 0-terminated), which<br />

in turn is followed by a two-byte little-endian-format module number in which the module in the library defining this<br />

string can be found. Thus, all strings start at even locations in the block.<br />

Byte 38 in a block records the free space left for storing strings in the block, and is an index of the same format as<br />

the bucket indices; that is, multiply the bucket index by two to find the next available slot in the block. If byte 38<br />

has the value 255, there is no space left.<br />

Dictionary Record (length is the dictionary size in 512-byte blocks)<br />

37 1 2 <br />

HTAB FFLAG Name Block Number Align Byte<br />

< --------------------------------- repeated -------------------------------------><br />

Entries consist of the following: the first byte is the length of the symbol to follow, the following bytes are the<br />

text of the symbol, and the last two bytes are a byte-swapped word field that specifies the page number<br />

(counting the library header as page 0) at which the module defining the symbol begins.<br />

All entries may have at most one trailing null byte in order to align the next entry on a word boundary.<br />

<strong>Module</strong> names are stored in the LHEADR record of each module.<br />

Extended Dictionary<br />

The extended dictionary is optional and indicates dependencies between modules in the library. Versions of LIB<br />

earlier than 3.09 do not create an extended dictionary. The extended dictionary is placed at the end of the library.<br />

The dictionary is preceded by these values:<br />

BYTE =0xF2 Extended Dictionary header<br />

WORD length of extended dictionary in bytes excluding first three bytes<br />

Start of extended dictionary:<br />

WORD number of modules in library = N<br />

Tool Interface Standards (TIS) <strong>OMF</strong> <strong>Specification</strong>, Version 1.1 73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!