You copied the Doc URL to your clipboard.

Symbol versioning script file

You can embed the commands to produce symbol versions in a script file that is specified by the command-line option --symver_script=file. Using this option automatically enables symbol versioning.

The script file supports the same syntax as the GNU ld linker.

Using a script file enables you to associate a version with an earlier version.

A steering file can be provided in addition to the embedded symbol method. If you choose to do this then your script file must match your embedded symbols and use the Backus-Naur Form (BNF) notation:

version_definition ::= 

  version_name "{" symbol_association* "}" [depend_version] ";"

The version_name is a string containing the name of the version. depend_version is a string containing the name of a version that this version_name depends on. This version must have already been defined in the script file. Version names are not significant, but it helps to choose readable names, for example:

symbol_association ::= 

  "local:" | "global:" | symbol_name ";"


  • "local:" indicates that all subsequent symbol_names in this version definition are local to the shared object and are not versioned.

  • "global:" indicates that all subsequent symbol_names belong to this version definition.

    There is an implicit "global:" at the start of every version definition.

  • symbol_name is the name of a global symbol in the static symbol table.


If you use a script file then the version definitions and symbols associated with them must match. The linker warns you if it detects any mismatch.