.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "NM 1" .TH NM 1 2024-05-07 binutils-2.42.0 "GNU Development Tools" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME nm \- list symbols from object files .SH SYNOPSIS .IX Header "SYNOPSIS" nm [\fB\-A\fR|\fB\-o\fR|\fB\-\-print\-file\-name\fR] [\fB\-a\fR|\fB\-\-debug\-syms\fR] [\fB\-B\fR|\fB\-\-format=bsd\fR] [\fB\-C\fR|\fB\-\-demangle\fR[=\fIstyle\fR]] [\fB\-D\fR|\fB\-\-dynamic\fR] [\fB\-f\fR\fIformat\fR|\fB\-\-format=\fR\fIformat\fR] [\fB\-g\fR|\fB\-\-extern\-only\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-\-ifunc\-chars=\fR\fICHARS\fR] [\fB\-j\fR|\fB\-\-format=just\-symbols\fR] [\fB\-l\fR|\fB\-\-line\-numbers\fR] [\fB\-\-inlines\fR] [\fB\-n\fR|\fB\-v\fR|\fB\-\-numeric\-sort\fR] [\fB\-P\fR|\fB\-\-portability\fR] [\fB\-p\fR|\fB\-\-no\-sort\fR] [\fB\-r\fR|\fB\-\-reverse\-sort\fR] [\fB\-S\fR|\fB\-\-print\-size\fR] [\fB\-s\fR|\fB\-\-print\-armap\fR] [\fB\-t\fR \fIradix\fR|\fB\-\-radix=\fR\fIradix\fR] [\fB\-u\fR|\fB\-\-undefined\-only\fR] [\fB\-U\fR|\fB\-\-defined\-only\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-W\fR|\fB\-\-no\-weak\fR] [\fB\-X 32_64\fR] [\fB\-\-no\-demangle\fR] [\fB\-\-no\-recurse\-limit\fR|\fB\-\-recurse\-limit\fR]] [\fB\-\-plugin\fR \fIname\fR] [\fB\-\-size\-sort\fR] [\fB\-\-special\-syms\fR] [\fB\-\-synthetic\fR] [\fB\-\-target=\fR\fIbfdname\fR] [\fB\-\-unicode=\fR\fImethod\fR] [\fB\-\-with\-symbol\-versions\fR] [\fB\-\-without\-symbol\-versions\fR] [\fIobjfile\fR...] .SH DESCRIPTION .IX Header "DESCRIPTION" GNU \fBnm\fR lists the symbols from object files \fIobjfile\fR.... If no object files are listed as arguments, \fBnm\fR assumes the file \&\fIa.out\fR. .PP For each symbol, \fBnm\fR shows: .IP \(bu 4 The symbol value, in the radix selected by options (see below), or hexadecimal by default. .IP \(bu 4 The symbol type. At least the following types are used; others are, as well, depending on the object file format. If lowercase, the symbol is usually local; if uppercase, the symbol is global (external). There are however a few lowercase symbols that are shown for special global symbols (\f(CW\*(C`u\*(C'\fR, \f(CW\*(C`v\*(C'\fR and \f(CW\*(C`w\*(C'\fR). .RS 4 .ie n .IP """A""" 4 .el .IP \f(CWA\fR 4 .IX Item "A" The symbol's value is absolute, and will not be changed by further linking. .ie n .IP """B""" 4 .el .IP \f(CWB\fR 4 .IX Item "B" .PD 0 .ie n .IP """b""" 4 .el .IP \f(CWb\fR 4 .IX Item "b" .PD The symbol is in the BSS data section. This section typically contains zero-initialized or uninitialized data, although the exact behavior is system dependent. .ie n .IP """C""" 4 .el .IP \f(CWC\fR 4 .IX Item "C" .PD 0 .ie n .IP """c""" 4 .el .IP \f(CWc\fR 4 .IX Item "c" .PD The symbol is common. Common symbols are uninitialized data. When linking, multiple common symbols may appear with the same name. If the symbol is defined anywhere, the common symbols are treated as undefined references. The lower case \fIc\fR character is used when the symbol is in a special section for small commons. .ie n .IP """D""" 4 .el .IP \f(CWD\fR 4 .IX Item "D" .PD 0 .ie n .IP """d""" 4 .el .IP \f(CWd\fR 4 .IX Item "d" .PD The symbol is in the initialized data section. .ie n .IP """G""" 4 .el .IP \f(CWG\fR 4 .IX Item "G" .PD 0 .ie n .IP """g""" 4 .el .IP \f(CWg\fR 4 .IX Item "g" .PD The symbol is in an initialized data section for small objects. Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array. .ie n .IP """i""" 4 .el .IP \f(CWi\fR 4 .IX Item "i" For PE format files this indicates that the symbol is in a section specific to the implementation of DLLs. .Sp For ELF format files this indicates that the symbol is an indirect function. This is a GNU extension to the standard set of ELF symbol types. It indicates a symbol which if referenced by a relocation does not evaluate to its address, but instead must be invoked at runtime. The runtime execution will then return the value to be used in the relocation. .Sp Note \- the actual symbols display for GNU indirect symbols is controlled by the \fB\-\-ifunc\-chars\fR command line option. If this option has been provided then the first character in the string will be used for global indirect function symbols. If the string contains a second character then that will be used for local indirect function symbols. .ie n .IP """I""" 4 .el .IP \f(CWI\fR 4 .IX Item "I" The symbol is an indirect reference to another symbol. .ie n .IP """N""" 4 .el .IP \f(CWN\fR 4 .IX Item "N" The symbol is a debugging symbol. .ie n .IP """n""" 4 .el .IP \f(CWn\fR 4 .IX Item "n" The symbol is in a non-data, non-code, non-debug read-only section. .ie n .IP """p""" 4 .el .IP \f(CWp\fR 4 .IX Item "p" The symbol is in a stack unwind section. .ie n .IP """R""" 4 .el .IP \f(CWR\fR 4 .IX Item "R" .PD 0 .ie n .IP """r""" 4 .el .IP \f(CWr\fR 4 .IX Item "r" .PD The symbol is in a read only data section. .ie n .IP """S""" 4 .el .IP \f(CWS\fR 4 .IX Item "S" .PD 0 .ie n .IP """s""" 4 .el .IP \f(CWs\fR 4 .IX Item "s" .PD The symbol is in an uninitialized or zero-initialized data section for small objects. .ie n .IP """T""" 4 .el .IP \f(CWT\fR 4 .IX Item "T" .PD 0 .ie n .IP """t""" 4 .el .IP \f(CWt\fR 4 .IX Item "t" .PD The symbol is in the text (code) section. .ie n .IP """U""" 4 .el .IP \f(CWU\fR 4 .IX Item "U" The symbol is undefined. .ie n .IP """u""" 4 .el .IP \f(CWu\fR 4 .IX Item "u" The symbol is a unique global symbol. This is a GNU extension to the standard set of ELF symbol bindings. For such a symbol the dynamic linker will make sure that in the entire process there is just one symbol with this name and type in use. .ie n .IP """V""" 4 .el .IP \f(CWV\fR 4 .IX Item "V" .PD 0 .ie n .IP """v""" 4 .el .IP \f(CWv\fR 4 .IX Item "v" .PD The symbol is a weak object. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, the value of the weak symbol becomes zero with no error. On some systems, uppercase indicates that a default value has been specified. .ie n .IP """W""" 4 .el .IP \f(CWW\fR 4 .IX Item "W" .PD 0 .ie n .IP """w""" 4 .el .IP \f(CWw\fR 4 .IX Item "w" .PD The symbol is a weak symbol that has not been specifically tagged as a weak object symbol. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, the value of the symbol is determined in a system-specific manner without error. On some systems, uppercase indicates that a default value has been specified. .ie n .IP """\-""" 4 .el .IP \f(CW\-\fR 4 .IX Item "-" The symbol is a stabs symbol in an a.out object file. In this case, the next values printed are the stabs other field, the stabs desc field, and the stab type. Stabs symbols are used to hold debugging information. .ie n .IP """?""" 4 .el .IP \f(CW?\fR 4 .IX Item "?" The symbol type is unknown, or object file format specific. .RE .RS 4 .RE .IP \(bu 4 The symbol name. If a symbol has version information associated with it, then the version information is displayed as well. If the versioned symbol is undefined or hidden from linker, the version string is displayed as a suffix to the symbol name, preceded by an @ character. For example \&\fBfoo@VER_1\fR. If the version is the default version to be used when resolving unversioned references to the symbol, then it is displayed as a suffix preceded by two @ characters. For example \fBfoo@@VER_2\fR. .SH OPTIONS .IX Header "OPTIONS" The long and short forms of options, shown here as alternatives, are equivalent. .IP \fB\-A\fR 4 .IX Item "-A" .PD 0 .IP \fB\-o\fR 4 .IX Item "-o" .IP \fB\-\-print\-file\-name\fR 4 .IX Item "--print-file-name" .PD Precede each symbol by the name of the input file (or archive member) in which it was found, rather than identifying the input file once only, before all of its symbols. .IP \fB\-a\fR 4 .IX Item "-a" .PD 0 .IP \fB\-\-debug\-syms\fR 4 .IX Item "--debug-syms" .PD Display all symbols, even debugger-only symbols; normally these are not listed. .IP \fB\-B\fR 4 .IX Item "-B" The same as \fB\-\-format=bsd\fR (for compatibility with the MIPS \fBnm\fR). .IP \fB\-C\fR 4 .IX Item "-C" .PD 0 .IP \fB\-\-demangle[=\fR\fIstyle\fR\fB]\fR 4 .IX Item "--demangle[=style]" .PD Decode (\fIdemangle\fR) low-level symbol names into user-level names. Besides removing any initial underscore prepended by the system, this makes C++ function names readable. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler. .IP \fB\-\-no\-demangle\fR 4 .IX Item "--no-demangle" Do not demangle low-level symbol names. This is the default. .IP \fB\-\-recurse\-limit\fR 4 .IX Item "--recurse-limit" .PD 0 .IP \fB\-\-no\-recurse\-limit\fR 4 .IX Item "--no-recurse-limit" .IP \fB\-\-recursion\-limit\fR 4 .IX Item "--recursion-limit" .IP \fB\-\-no\-recursion\-limit\fR 4 .IX Item "--no-recursion-limit" .PD Enables or disables a limit on the amount of recursion performed whilst demangling strings. Since the name mangling formats allow for an infinite level of recursion it is possible to create strings whose decoding will exhaust the amount of stack space available on the host machine, triggering a memory fault. The limit tries to prevent this from happening by restricting recursion to 2048 levels of nesting. .Sp The default is for this limit to be enabled, but disabling it may be necessary in order to demangle truly complicated names. Note however that if the recursion limit is disabled then stack exhaustion is possible and any bug reports about such an event will be rejected. .IP \fB\-D\fR 4 .IX Item "-D" .PD 0 .IP \fB\-\-dynamic\fR 4 .IX Item "--dynamic" .PD Display the dynamic symbols rather than the normal symbols. This is only meaningful for dynamic objects, such as certain types of shared libraries. .IP "\fB\-f\fR \fIformat\fR" 4 .IX Item "-f format" .PD 0 .IP \fB\-\-format=\fR\fIformat\fR 4 .IX Item "--format=format" .PD Use the output format \fIformat\fR, which can be \f(CW\*(C`bsd\*(C'\fR, \&\f(CW\*(C`sysv\*(C'\fR, \f(CW\*(C`posix\*(C'\fR or \f(CW\*(C`just\-symbols\*(C'\fR. The default is \f(CW\*(C`bsd\*(C'\fR. Only the first character of \fIformat\fR is significant; it can be either upper or lower case. .IP \fB\-g\fR 4 .IX Item "-g" .PD 0 .IP \fB\-\-extern\-only\fR 4 .IX Item "--extern-only" .PD Display only external symbols. .IP \fB\-h\fR 4 .IX Item "-h" .PD 0 .IP \fB\-\-help\fR 4 .IX Item "--help" .PD Show a summary of the options to \fBnm\fR and exit. .IP \fB\-\-ifunc\-chars=\fR\fICHARS\fR 4 .IX Item "--ifunc-chars=CHARS" When display GNU indirect function symbols \fBnm\fR will default to using the \f(CW\*(C`i\*(C'\fR character for both local indirect functions and global indirect functions. The \fB\-\-ifunc\-chars\fR option allows the user to specify a string containing one or two characters. The first character will be used for global indirect function symbols and the second character, if present, will be used for local indirect function symbols. .IP \fBj\fR 4 .IX Item "j" The same as \fB\-\-format=just\-symbols\fR. .IP \fB\-l\fR 4 .IX Item "-l" .PD 0 .IP \fB\-\-line\-numbers\fR 4 .IX Item "--line-numbers" .PD For each symbol, use debugging information to try to find a filename and line number. For a defined symbol, look for the line number of the address of the symbol. For an undefined symbol, look for the line number of a relocation entry which refers to the symbol. If line number information can be found, print it after the other symbol information. .IP \fB\-\-inlines\fR 4 .IX Item "--inlines" When option \fB\-l\fR is active, if the address belongs to a function that was inlined, then this option causes the source information for all enclosing scopes back to the first non-inlined function to be printed as well. For example, if \f(CW\*(C`main\*(C'\fR inlines \&\f(CW\*(C`callee1\*(C'\fR which inlines \f(CW\*(C`callee2\*(C'\fR, and address is from \&\f(CW\*(C`callee2\*(C'\fR, the source information for \f(CW\*(C`callee1\*(C'\fR and \f(CW\*(C`main\*(C'\fR will also be printed. .IP \fB\-n\fR 4 .IX Item "-n" .PD 0 .IP \fB\-v\fR 4 .IX Item "-v" .IP \fB\-\-numeric\-sort\fR 4 .IX Item "--numeric-sort" .PD Sort symbols numerically by their addresses, rather than alphabetically by their names. .IP \fB\-p\fR 4 .IX Item "-p" .PD 0 .IP \fB\-\-no\-sort\fR 4 .IX Item "--no-sort" .PD Do not bother to sort the symbols in any order; print them in the order encountered. .IP \fB\-P\fR 4 .IX Item "-P" .PD 0 .IP \fB\-\-portability\fR 4 .IX Item "--portability" .PD Use the POSIX.2 standard output format instead of the default format. Equivalent to \fB\-f posix\fR. .IP \fB\-r\fR 4 .IX Item "-r" .PD 0 .IP \fB\-\-reverse\-sort\fR 4 .IX Item "--reverse-sort" .PD Reverse the order of the sort (whether numeric or alphabetic); let the last come first. .IP \fB\-S\fR 4 .IX Item "-S" .PD 0 .IP \fB\-\-print\-size\fR 4 .IX Item "--print-size" .PD Print both value and size of defined symbols for the \f(CW\*(C`bsd\*(C'\fR output style. This option has no effect for object formats that do not record symbol sizes, unless \fB\-\-size\-sort\fR is also used in which case a calculated size is displayed. .IP \fB\-s\fR 4 .IX Item "-s" .PD 0 .IP \fB\-\-print\-armap\fR 4 .IX Item "--print-armap" .PD When listing symbols from archive members, include the index: a mapping (stored in the archive by \fBar\fR or \fBranlib\fR) of which modules contain definitions for which names. .IP "\fB\-t\fR \fIradix\fR" 4 .IX Item "-t radix" .PD 0 .IP \fB\-\-radix=\fR\fIradix\fR 4 .IX Item "--radix=radix" .PD Use \fIradix\fR as the radix for printing the symbol values. It must be \&\fBd\fR for decimal, \fBo\fR for octal, or \fBx\fR for hexadecimal. .IP \fB\-u\fR 4 .IX Item "-u" .PD 0 .IP \fB\-\-undefined\-only\fR 4 .IX Item "--undefined-only" .PD Display only undefined symbols (those external to each object file). By default both defined and undefined symbols are displayed. .IP \fB\-U\fR 4 .IX Item "-U" .PD 0 .IP \fB\-\-defined\-only\fR 4 .IX Item "--defined-only" .PD Display only defined symbols for each object file. By default both defined and undefined symbols are displayed. .IP \fB\-V\fR 4 .IX Item "-V" .PD 0 .IP \fB\-\-version\fR 4 .IX Item "--version" .PD Show the version number of \fBnm\fR and exit. .IP \fB\-X\fR 4 .IX Item "-X" This option is ignored for compatibility with the AIX version of \&\fBnm\fR. It takes one parameter which must be the string \&\fB32_64\fR. The default mode of AIX \fBnm\fR corresponds to \fB\-X 32\fR, which is not supported by GNU \fBnm\fR. .IP "\fB\-\-plugin\fR \fIname\fR" 4 .IX Item "--plugin name" Load the plugin called \fIname\fR to add support for extra target types. This option is only available if the toolchain has been built with plugin support enabled. .Sp If \fB\-\-plugin\fR is not provided, but plugin support has been enabled then \fBnm\fR iterates over the files in \&\fI${libdir}/bfd\-plugins\fR in alphabetic order and the first plugin that claims the object in question is used. .Sp Please note that this plugin search directory is \fInot\fR the one used by \fBld\fR's \fB\-plugin\fR option. In order to make \&\fBnm\fR use the linker plugin it must be copied into the \&\fI${libdir}/bfd\-plugins\fR directory. For GCC based compilations the linker plugin is called \fIliblto_plugin.so.0.0.0\fR. For Clang based compilations it is called \fILLVMgold.so\fR. The GCC plugin is always backwards compatible with earlier versions, so it is sufficient to just copy the newest one. .IP \fB\-\-size\-sort\fR 4 .IX Item "--size-sort" Sort symbols by size. For ELF objects symbol sizes are read from the ELF, for other object types the symbol sizes are computed as the difference between the value of the symbol and the value of the symbol with the next higher value. If the \f(CW\*(C`bsd\*(C'\fR output format is used the size of the symbol is printed, rather than the value, and \&\fB\-S\fR must be used in order both size and value to be printed. .Sp Note \- this option does not work if \fB\-\-undefined\-only\fR has been enabled as undefined symbols have no size. .IP \fB\-\-special\-syms\fR 4 .IX Item "--special-syms" Display symbols which have a target-specific special meaning. These symbols are usually used by the target for some special processing and are not normally helpful when included in the normal symbol lists. For example for ARM targets this option would skip the mapping symbols used to mark transitions between ARM code, THUMB code and data. .IP \fB\-\-synthetic\fR 4 .IX Item "--synthetic" Include synthetic symbols in the output. These are special symbols created by the linker for various purposes. They are not shown by default since they are not part of the binary's original source code. .IP \fB\-\-unicode=\fR\fI[default|invalid|locale|escape|hex|highlight]\fR 4 .IX Item "--unicode=[default|invalid|locale|escape|hex|highlight]" Controls the display of UTF\-8 encoded multibyte characters in strings. The default (\fB\-\-unicode=default\fR) is to give them no special treatment. The \fB\-\-unicode=locale\fR option displays the sequence in the current locale, which may or may not support them. The options \&\fB\-\-unicode=hex\fR and \fB\-\-unicode=invalid\fR display them as hex byte sequences enclosed by either angle brackets or curly braces. .Sp The \fB\-\-unicode=escape\fR option displays them as escape sequences (\fI\euxxxx\fR) and the \fB\-\-unicode=highlight\fR option displays them as escape sequences highlighted in red (if supported by the output device). The colouring is intended to draw attention to the presence of unicode sequences where they might not be expected. .IP \fB\-W\fR 4 .IX Item "-W" .PD 0 .IP \fB\-\-no\-weak\fR 4 .IX Item "--no-weak" .PD Do not display weak symbols. .IP \fB\-\-with\-symbol\-versions\fR 4 .IX Item "--with-symbol-versions" .PD 0 .IP \fB\-\-without\-symbol\-versions\fR 4 .IX Item "--without-symbol-versions" .PD Enables or disables the display of symbol version information. The version string is displayed as a suffix to the symbol name, preceded by an @ character. For example \fBfoo@VER_1\fR. If the version is the default version to be used when resolving unversioned references to the symbol then it is displayed as a suffix preceded by two @ characters. For example \fBfoo@@VER_2\fR. By default, symbol version information is displayed. .IP \fB\-\-target=\fR\fIbfdname\fR 4 .IX Item "--target=bfdname" Specify an object code format other than your system's default format. .IP \fB@\fR\fIfile\fR 4 .IX Item "@file" Read command-line options from \fIfile\fR. The options read are inserted in place of the original @\fIfile\fR option. If \fIfile\fR does not exist, or cannot be read, then the option will be treated literally, and not removed. .Sp Options in \fIfile\fR are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The \fIfile\fR may itself contain additional @\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBar\fR\|(1), \fBobjdump\fR\|(1), \fBranlib\fR\|(1), and the Info entries for \fIbinutils\fR. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c) 1991\-2024 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".