8.3. Symbol preemption

Some platforms allow symbols to be preempted at run-time. This means that the dynamic loader can load a number of implementations of a particular function and select the most appropriate implementation at run-time. This is normally achieved by using version information embedded into the executable module.

The selected implementation is used for all STV_DEFAULT visibility references to that particular symbol, even when the module itself contains a definition of the symbol being preempted.

For a particular symbol to be preempted it must have STV_DEFAULT visibility. Symbols given STV_PROTECTED visibility cannot be preempted at run-time.

A preemptable symbol definition can be preempted by the dynamic linker. This means that the dynamic linker might use a different definition of the symbol at run-time. Therefore all references to the symbol must be made as if the symbol is external to the module (given STV_DEFAULT visibility) and the static linker leaves it to the dynamic linker to handle the symbol reference at run-time. This means that the static linker creates a relocation and possibly a PLT entry for each function call. This allows the dynamic linker to retarget the branch instruction or PLT sequence to the correct pre-empting function. PLTs are described in more detail in Handling function calls between modules.

STV_PROTECTED symbols cannot be preempted at run-time. Any function calls from the same module to an STV_PROTECTED symbol are not directed using a PLT. A branch instruction is generated instead. However, the PLT is still generated by the static linker because it does not know whether other modules make use of such functions.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A