Subsection Directory

The subsection directory has the format

Directory header

Directory entry 0

Directory entry 1

.

.

.

Directory entry n


The subsection directory is prefixed with a directory header structure indicating size and number of subsection directory entries that follow.

2

2

4

4

4

cbDirHeader

cbDirEntry

cDir

lfoNextDir

flags


cbDirHeader Length of the directory header

cbDirEntry Length of each directory entry

cDir Number of directory entries

lfoNextDir Offset from lfaBase of next directory. This field is currently unused. It is intended for use by the incremental linker to point to the next directory containing Symbol and Type OMF information from an incremental link.

flags Flags describing directory and subsection tables. No values have been defined for this field.

The directory header structure is followed by the directory entries which specify the subsection type, module index if applicable, the subsection offset, and subsection size.

2

2

4

4

subsection

iMod

lfo

cb


subsection Subdirectory index. See the table below for a listing of the valid subsection indices.

iMod Module index. This number is 1 based and zero is never a valid index. The index 0xffff is reserved for tables that are not associated with a specific module. These tables include sstLibraries, sstGlobalSym, sstGlobalPub and sstGlobalTypes.

lfo Offset from the base address lfaBase

cb Number of bytes in subsection

There is no requirement for a particular subsection to exist for a particular module. There is a preferred order for subsections within the Symbol and Type OMF portion and the subsection directory of the file as emitted by the linker (NB05 signature). The preferred order is:

sstModule1

Module 1

.

.

sstModulen

Module n

sstTypes1

Module 1

sstPublics1

Module 1

sstSymbols1

Module 1

sstSrcModule1

Module 1

.

sstTypesn

Module n

sstPublicsn

Module n

sstSymbolsn

Module n

sstSrcModulen

Module n

sstLibraries

directory


However, if the tables are not written in this order by the linker, CVPACK will sort the subsection table into this order and read the subsections in this order by seeking to the correct location. The net effect is that packing will be less efficient but will work.

CVPACK will write the Symbol and Type OMF back to the file in the following order. CodeView requires that the sstModule entries be first and sequential in the subsection directory. For performance reasons, it is recommended that the order of the subsections in the file match the order of the subsection directory entries.

For signatures prior to NB09, the packed file has the following subsections and ordering.

NBxx

signature

lfoDir

directory offset

sstModule1

Module 1

.

.

sstModulen

Module n

sstAlignSym1

Module 1

sstSrcModule1

Module 1

.

sstAlignSymn

Module n

sstSrcModulen

Module n

sstGlobalPub

Global Publics

sstGlobalSym

Global Symbols

sstLibraries

Libraries

sstGlobalTypes

Global Types

Directory

NBxx

signature if OMF executable

lfoBase

offset of base if OMF executable


For NB09 signatures, the packed file has the following subsections and ordering.

NBxx

signature

lfoDir

directory offset

sstModule1

Module 1

.

.

sstModulen

Module n

sstAlignSym1

Module 1

sstSrcModule1

Module 1

.

sstAlignSymn

Module n

sstSrcModulen

Module n

sstGlobalPub

Global Publics

sstGlobalSym

Global Symbols

sstLibraries

Libraries

sstGlobalTypes

Global Types

sstStaticSym

Static Symbols

sstFileIndex

File Index

sstOffsetMap16 sstOffsetMat32

Directory

NBxx

signature

lfoBase

offset