8.2. Populating the dynamic symbol table
As mentioned in Chapter 6 ELF overview and background, an executable module might have two
symbol tables, a static symbol table and dynamic symbol table. The
static symbol table is generated by the static linker from the symbol
tables of the input object files. It is not used by a dynamic linker
and is normally removed from the ELF in release modules.The dynamic
symbol table is used by the dynamic linker to identify the symbols
defined and referenced in a module. The dynamic symbol table is
also created by the static linker. How the static linker populates
the dynamic symbol table is toolchain and platform specific.Static
linkers normally use a fixed method, or alternatively allow the
user to select how to populate the dynamic symbol table, giving
them full control. The latter approach requires the user to specify
which symbols must be present in the dynamic symbol table. This
is normally achieved using a textual input file to the linker.Another
method, probably the most common, is to populate the dynamic symbol
table based on the symbol visibility in the static symbol table.
Symbols with STV_DEFAULT or STV_PROTECTED visibility
are automatically added to the dynamic symbol table. Symbols with STV_HIDDEN or STV_INTERNAL visibility
are not normally added to the dynamic symbol table.