as: Symver
7.94 '.symver'
==============
Use the '.symver' directive to bind symbols to specific version nodes
within a source file. This is only supported on ELF platforms, and is
typically used when assembling files to be linked into a shared library.
There are cases where it may make sense to use this in objects to be
bound into an application itself so as to override a versioned symbol
from a shared library.
For ELF targets, the '.symver' directive can be used like this:
.symver NAME, NAME2@NODENAME
If the symbol NAME is defined within the file being assembled, the
'.symver' directive effectively creates a symbol alias with the name
NAME2@NODENAME, and in fact the main reason that we just don't try and
create a regular alias is that the @ character isn't permitted in symbol
names. The NAME2 part of the name is the actual name of the symbol by
which it will be externally referenced. The name NAME itself is merely
a name of convenience that is used so that it is possible to have
definitions for multiple versions of a function within a single source
file, and so that the compiler can unambiguously know which version of a
function is being mentioned. The NODENAME portion of the alias should
be the name of a node specified in the version script supplied to the
linker when building a shared library. If you are attempting to
override a versioned symbol from a shared library, then NODENAME should
correspond to the nodename of the symbol you are trying to override.
If the symbol NAME is not defined within the file being assembled,
all references to NAME will be changed to NAME2@NODENAME. If no
reference to NAME is made, NAME2@NODENAME will be removed from the
symbol table.
Another usage of the '.symver' directive is:
.symver NAME, NAME2@@NODENAME
In this case, the symbol NAME must exist and be defined within the
file being assembled. It is similar to NAME2@NODENAME. The difference
is NAME2@@NODENAME will also be used to resolve references to NAME2 by
the linker.
The third usage of the '.symver' directive is:
.symver NAME, NAME2@@@NODENAME
When NAME is not defined within the file being assembled, it is
treated as NAME2@NODENAME. When NAME is defined within the file being
assembled, the symbol name, NAME, will be changed to NAME2@@NODENAME.