Prev | Current Page 1418 | Next

Christopher Negus

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

options control nm??™s behavior. Symbols are things like functions referenced
NOTE
789
Programming Tools and Utilities 29
in the code, global variables from other libraries, and so on. You can use the nm command as a tool
when you have to track down a missing symbol needed by a program.
Table 29-3 describes useful options for nm.
TABLE 29-3
nm Command-Line Options
Option Description
-C Converts symbol names into user-level names. This is especially useful for making
C++ function names readable.
-l Uses debugging information to print the line number where each symbol is defined,
or the relocation entry if the symbol is undefined.
-s When used on archive (.a) files, prints the index that maps symbol names to the
modules or members in which the symbol is defined.
-u Displays only undefined symbols, symbols defined externally to the file being
examined.
Here??™s an example that uses nm to show some of the symbols in /usr/lib/libdl.a:
$ nm /usr/lib/libdl.a | head
dlopen.o:
00000040 T __dlopen_check
U _dl_open
U _dlerror_run
00000040 W dlopen
00000000 t dlopen_doit
dlclose.o:
U _dl_close
The ar Command
ar creates, modifies, or extracts archives. It is most commonly used to create static libraries, which
are files that contain one or more object files.


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