Version Command - Red Hat ENTERPRISE LINUX 3 - USING ID Using Instructions

Using ld, the gnu linker
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING ID:
Table of Contents

Advertisement

Chapter 4. Linker Scripts

4.9. VERSION Command

The linker supports symbol versions when using ELF. Symbol versions are only useful when using
shared libraries. The dynamic linker can use symbol versions to select a specific version of a function
when it runs a program that may have been linked against an earlier version of the shared library.
You can include a version script directly in the main linker script, or you can supply the version script
as an implicit linker script. You can also use the
The syntax of the
VERSION
VERSION { version-script-commands }
The format of the version script commands is identical to that used by Sun's linker in Solaris 2.5. The
version script defines a tree of version nodes. You specify the node names and interdependencies in
the version script. You can specify which symbols are bound to which version nodes, and you can
reduce a specified set of symbols to local scope so that they are not globally visible outside of the
shared library.
The easiest way to demonstrate the version script language is with a few examples.
VERS_1.1 {
global:
foo1;
local:
old*;
original*;
new*;
};
VERS_1.2 {
foo2;
} VERS_1.1;
VERS_2.0 {
bar1; bar2;
} VERS_1.2;
This example version script defines three version nodes. The first version node defined is
it has no other dependencies. The script binds the symbol
of symbols to local scope so that they are not visible outside of the shared library; this is done using
wildcard patterns, so that any symbol whose name begins with
The wildcard patterns available are the same as those used in the shell when matching filenames (also
known as "globbing").
Next, the version script defines node
the symbol
to the version node
foo2
Finally, the version script defines node
binds the symbols
bar1
When the linker finds a symbol defined in a library which is not specifically bound to a version node,
it will effectively bind it to an unspecified base version of the library. You can bind all otherwise
unspecified symbols to a given version node by using
The names of the version nodes have no specific meaning other than what they might suggest to the
person reading them. The
However, this would be a confusing way to write a version script.
command is simply
VERS_1.2
VERS_1.2
VERS_2.0
and
are bound to the version node
bar2
version could just as well have appeared in between
2.0
-version-script
to
foo1
old
. This node depends upon
.
. This node depends upon
VERS_2.0
global: *;
linker option.
. It reduces a number
VERS_1.1
,
, or
original
new
. The script binds
VERS_1.1
. The scripts
VERS_1.2
.
somewhere in the version script.
1.1
49
;
VERS_1.1
is matched.
and
.
1.2

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents