Prev | Current Page 1417 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

Shared libraries have a special name, the soname, that consists of the
library name and the major version number. The full name of the C library on one of my systems,
for example, is libc-2.3.4.so. The library name is libc.so; the major version number is 2; the minor
version number is 3; and the release or patch level is 4. For historical reasons, the C library??™s soname
is libc.so.6. Minor version numbers and patch level numbers change as bugs are fixed, but the
soname remains the same and newer versions are usually compatible with older versions.
I emphasize the soname because applications link against it. How does linking work? The ldconfig
utility creates a symbolic link from the actual library (for example, libc-2.3.2.so) to the soname
(for example, libc.so.6), and stores this information in /etc/ld.so.cache. At runtime, ld.so
scans the cache file, finds the required soname and, because of the symbolic link, loads the actual
library into memory and links application function calls to the appropriate symbols in the loaded
library.
The nm Command
The nm command lists all of the symbols encoded in an object or binary file. It??™s used to see what
function calls a program makes or to see if a library or object file provides a needed function. nm
has the following syntax:
nm [options] file
nm lists the symbols stored in file, which must be a static library or archive file, as described in
the preceding section.


Pages:
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429