Node:Symbol Table Format, Next:Transformations On Symbol Tables, Up:Symbol Tables

### Symbol Table Format

Each time the assembler encounters a stab directive, it puts each field of the stab into a corresponding field in a symbol table entry of its output file. If the stab contains a string field, the symbol table entry for that stab points to a string table entry containing the string data from the stab. Assembler labels become relocatable addresses. Symbol table entries in a.out have the format:

         struct internal_nlist {
           unsigned long n_strx;         /* index into string table of name */
           unsigned char n_type;         /* type of symbol */
           unsigned char n_other;        /* misc info (usually empty) */
           unsigned short n_desc;        /* description field */
           bfd_vma n_value;              /* value of symbol */
         };

If the stab has a string, the `n_strx` field holds the offset in bytes of the string within the string table. The string is terminated by a NUL character. If the stab lacks a string (for example, it was produced by a `.stabn` or `.stabd` directive), the `n_strx` field is zero.

Symbol table entries with `n_type` field values greater than 0x1f originated as stabs generated by the compiler (with one random exception). The other entries were placed in the symbol table of the executable by the assembler or the linker.