4.23 Using compiler and linker support for symbol versions

The compiler and the linker both support the GNU-extended symbol versioning model.

To create a function with a symbol version in C or C++ code, you must use the assembly label GNU extension. Use this extension to rename the function symbol into a symbol that has either of the following names:

  • function@@ver for a default ver of function.

  • function@ver for a nondefault ver of function.

For example, to define a default version:

int new_function(void) __asm__("versioned_fun@@ver2");
int new_function(void)
{
    return 2;
}

To define a nondefault version:

int old_function(void) __asm__("versioned_fun@ver1");
int old_function(void)
{
    return 1;
}
Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.