The nm utility displays the symbol table of each ELF object file that is specified by file.
If no symbolic information is available for a valid input file, the nm utility will report that fact, but not consider it an error condition.
The output of nm may be controlled using the following options:
Write the full path name or library name of an object on each line.
Demangle C++ symbol names before printing them out.
Display the SHT_DYNSYM symbol information. This is the symbol table used by ld.so.1 and is present even in stripped dynamic executables. By default the SHT_SYMTAB symbol table is displayed.
See NOTES below.
See NOTES below.
Write only external (global) symbol information.
Do not display the output heading data.
Distinguish between WEAK and GLOBAL symbols by appending a * to the key letter for WEAK symbols.
Sort external symbols by name before they are printed.
Print the value and size of a symbol in octal instead of decimal (equivalent to -t o).
Produce easy to parse, terse output. Each symbol name is preceded by its value (blanks if undefined) and one of the letters:
bss (uninitialized data space) symbol
data object symbol
symbol has no type
If the symbol's binding attribute is:
the key letter is lower case
the key letter is upper case; if the -l modifier is specified, the upper case key letter is followed by a *
the key letter is upper case.
Write information in a portable output format, as specified in Standard Output.
Prepend the name of the object file or archive to each output line.
Print the archive name (if present), followed by the object file and symbol name. If the -r option is also specified, this option is ignored.
Print section name instead of section index.
Write each numeric value in the specified format. The format is dependent on the single character used as the format option-argument:
The offset is written in decimal (default).
The offset is written in octal.
The offset is written in hexadecimal.
See NOTES below.
Print long listing for each undefined symbol. See OUTPUT below.
Sort external symbols by value before they are printed.
Print the version of the nm command executing on the standard error output.
Print the value and size of a symbol in hexadecimal instead of decimal (equivalent to -t x).
Options may be used in any order, either singly or in combination, and may appear anywhere in the command line. When conflicting options are specified (such as -v and -n, or -o and -x) the first is taken and the second ignored with a warning message to the user. (See -R for exception.)
The following operand is supported:
A path name of an object file, executable file or object-file library.
For each symbol, the following information will be printed:
The index of the symbol. (The index appears in brackets.)
A section offset for defined symbols in a relocatable file.
Alignment constraints for symbols whose section index is SHN_COMMON.
A virtual address in executable and dynamic library files.
The size in bytes of the associated object.
No type was specified.
A data object such as an array or variable.
A function or other executable code.
A register symbol (SPARC only).
A section symbol.
Name of the source file.
The symbol's binding attributes.
Have a scope limited to the object file containing their definition.
Are visible to all object files being combined.
Are essentially global symbols with a lower precedence than GLOBAL.
A field reserved for future use, currently containing 0.
Except for three special values, this is the section header table index in relation to which the symbol is defined. The following special values exist:
Indicates the symbol's value will not change through relocation.
Indicates an unallocated block and the value provides alignment constraints.
Indicates an undefined symbol.
The name of the symbol.
The name of the object or library if -A is specified.
If the -P option is specified, the previous information is displayed using the following portable format. The three versions differ depending on whether -t d, -t o, or -t x was specified, respectively:
"%s%s %s %d %d\n", <library/object name>, name, type, value, size "%s%s %s %o %o\n", <library/object name>, name, type, value, size "%s%s %s %x %x\n", <library/object name>, name, type, value, size
where <library/object name> is formatted as follows:
If -A is not specified, <library/object name> is an empty string.
"%s: ", file
"%s[%s]: ", file, <object file>
If -A is not specified, then if more than one file operand is specified or if only one file operand is specified and it names a library, nm will write a line identifying the object containing the following symbols before the lines containing those symbols, in the form:
"%s[%s]:\n", file, <object file>
If -P is specified, but -t is not, the format is as if -t x had been specified.
See environ(5) for descriptions of the following environment variables that affect the execution of nm: LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH.
See attributes(5) for descriptions of the following attributes:
The following options are obsolete because of changes to the object file format and will be deleted in a future release.
Print only external and static symbols. The symbol table now contains only static and external symbols. Automatic symbols no longer appear in the symbol table. They do appear in the debugging information produced by cc -g, which may be examined using dump(1).
Produce full output. Redundant symbols (such as .text, .data, and so forth), which existed previously, do not exist and producing full output will be identical to the default output.
By default, nm prints the entire name of the symbols listed. Since symbol names have been moved to the last column, the problem of overflow is removed and it is no longer necessary to truncate the symbol name.