You can add specially-named symbols to input objects that cause the linker to create symbol versions.
These symbols are of the form:
name@versionfor a non-default version of a symbol.
name@@versionfor a default version of a symbol.
You must define these symbols, at the address of the function or data, as that you want to
export. The symbol name is divided into two parts, a symbol name
and a version definition
is added to the dynamic symbol table and becomes
part of the interface to the shared object. Version creates a version called
if it does not already exist and associates
with the version called
The following example places the symbols
bar@@ver1 into the object symbol
int old_function(void) __asm__("foo@ver1"); int new_function(void) __asm__("foo@@ver2"); int other_function(void) __asm__("bar@@ver1");
The linker reads these symbols and creates version definitions
ver2. The symbol
foo is associated with a non-default
ver1, and with a default version of
bar is associated with a default version of
There is no way to create associations between versions with this method.