General
Format of Symbol Records
Data in the $$SYMBOLS segment is a stream of variable length records with the general format:
length Length of record, excluding the length field
index Type of symbol
data Data specific to each symbol format
The symbol records are described below. Numbers above the fields indicate the length in bytes, and * means variable length for that field.
Symbol indices are broken into five ranges. The first range is for symbols whose format does not change with the compilation model of the program or the target machine. These include register symbols, user-defined type symbols, and so on. The second range of symbols are those that contain 16:16 segmented addresses. The third symbol range is for symbols that contain 16:32 addresses. Note that for flat model programs, the segment is replaced with the section number for PE executable files. The fourth symbol range is for symbols which are specific to the MIPS architecture/compiler. The fifth range is for CodeView optimization.
The symbol records are formatted such that most fields fall into natural alignment if the symbol length field is placed on a long word boundary. For all symbols, the variable length data is at the end of the symbol structure. Note specifically that fields that contain data in potentially nonaligned numeric fields must either pay the load penalty or first do a byte wise copy of the data to a memory that is in natural alignment. Refer to Section 4 for details about numeric leaves.
16:16 compilers do not have to emit padding bytes between symbols to maintain natural alignment. The CVPACK utility places the symbols into the executable files in natural alignment and zero pads the symbol to force alignment. The length of each symbol is adjusted to account for the pad bytes. 16:32 compilers must align symbols on a long word boundary.
Provisions for enabling future implementation of register tracking and a stack machine to perform computation on symbol addresses are provided in the symbols. When the symbol processor is examining a symbol, the length field of the symbol is compared with the offset of the byte following the end of the symbol name field. If these are the same, there is no stack machine code at the end of the symbol. If the length and offset are different, the byte following the end of the symbol name is examined. If the byte is zero, there is no stack machine code following the symbol. If the byte is not zero, then the byte indexes into the list of stack machine implementations and styles of register tracking. If stack machine code is present, the address field of the symbol becomes the initial value of the stack machine. Microsoft does not currently emit or process stack machine code or register tracking information. The opcodes and operation of the stack machine has not been defined.
Symbol Indices
*[Note: All symbol records that included one or more CV_typ_t fields have been renamed by having "_16t" appended to their original names. For instance, the symbol record for S_BPREL32 that included a 16-bit CV_typ_t (now known as CV_typ16_t) is now S_BPREL32_16t. The records that were so changed all have indices (record type fields) with the 0x1000 bit set. Records that did not contain CV_typ_t fields were left unchanged.]
0x0001 S_COMPILE Compile flags symbol
0x0005 S_SSEARCH Start search
0x0006 S_END End block, procedure, with, or thunk
0x0007 S_SKIP Skip - Reserve symbol space
0x0008 S_CVRESERVE Reserved for CodeView internal use
0x0009 S_OBJNAME Specify name of object file
0x000a S_ENDARG Specify end of arguments in function symbols
0x000b S_COBOLUDT Microfocus COBOL user-defined type
0x000c S_MANYREG Many register symbol
0x000d S_RETURN Function return description
0x000e S_ENTRYTHIS Description of this pointer at entry
0x1001 S_REGISTER Register variable
0x1002 S_CONSTANT Constant symbol
0x1003 S_UDT User-defined type
0x1004 S_COBOLUDT Microfocus COBOL user-defined type
0x1005 S_MANYREG Many register symbol
0x1006 S_BPREL32 BP relative 16:32
0x1007 S_LDATA32 Local data 16:32
0x1008 S_GDATA32 Global data 16:32
0x1009 S_PUB32 Public symbol 16:32
0x100a S_LPROC32 Local procedure start 16:32
0x100b S_GPROC32 Global procedure start 16:32
0x0206 S_THUNK32 Thunk start 16:32
0x0207 S_BLOCK32 Block start 16:32
0x0208 S_WITH32 With start 16:32
0x0209 S_LABEL32 Label 16:32
0x020a S_CEXMODEL32 Change execution model 16:32
0x100c S_VFTTABLE32 Virtual function table path descriptor 16:32
0x100d S_REGREL32 16:32 offset relative to arbitrary register
0x100e S_LTHREAD32 Local Thread Storage data
0x100f S_GTHREAD32 Global Thread Storage data
0x1010 S_LPROCMIPS Local procedure start MIPS
0x1011 S_GPROCMIPS Global procedure start MIPS
0x0400 S_PROCREF Reference to a procedure
0x0401 S_DATAREF Reference to data
0x0402 S_ALIGN Page align symbols