|
|
After the dynamic linker has built the process image and performed the relocations, each shared object gets the opportunity to execute some initialization code. These initialization functions are called in no specified order, but all shared object initializations happen before the executable file gains control.
Similarly, shared objects may have termination functions, which are executed with the atexit(S) mechanism after the base process begins its termination sequence. See atexit(S) for more information. Once again, the order in which the dynamic linker calls termination functions is unspecified.
Shared objects designate their initialization and
termination functions through the DT_INIT and
DT_FINI entries in the dynamic structure. See
``Dynamic section''
for more information. Typically, the
code for these functions resides in the .init
and
.fini
sections. See
``Section header''
for more information.