Linker and Libraries Guide

Symbol Table Layout and Conventions

The symbols in a symbol table are written in the following order.

Three symbol tables are of special interest in the Oracle Solaris OS.

.symtab (SHT_SYMTAB)

This symbol table contains every symbol that describes the associated ELF file. This symbol table is typically non-allocable, and is therefore not available in the memory image of the process.

Global symbols can be eliminated from the .symtab by using a mapfile together with the ELIMINATE keyword. See Symbol Elimination, and SYMBOL_SCOPE / SYMBOL_VERSION Directives. Local symbols can also be eliminated by using the link-editor -z redlocsym option.

.dynsym (SHT_DYNSYM)

This table contains a subset of the symbols from the .symtab table that are needed to support dynamic linking. This symbol table is allocable, and is therefore available in the memory image of the process.

The .dynsym table begins with the standard NULL symbol, followed by the files global symbols. STT_FILE symbols are typically not present in this symbol table. STT_SECTION symbols might be present if required by relocation entries.

.SUNW_ldynsym (SHT_SUNW_LDYNSYM)

An optional symbol table that augments the information that is found in the .dynsym table. The .SUNW_ldynsym table contains local function symbols. This symbol table is allocable, and is therefore available in the memory image of the process. This section allows debuggers to produce accurate stack traces in runtime contexts when the non-allocable .symtab is not available, or has been stripped from the file. This section also provides the runtime environment with additional symbolic information for use with dladdr(3C).

A .SUNW_ldynsym table only exists when a .dynsym table is present. When both a .SUNW_ldynsym section and a .dynsym section exist, the link-editor places their data regions directly adjacent to each other, with the .SUNW_ldynsym first. This placement allows the two tables to be viewed as a single larger contiguous symbol table. This symbol table follows the standard layout rules that were enumerated previously.

The .SUNW_ldynsym table can be eliminated by using the link-editor -z noldynsym option.