NM(1)
๐ NM(1) โ GNU Development Tools
ok so picture this: it's the nm page from the GNU Development Tools manual, and it's about to become your new hyperfixation. buckle up bestie, we're reading symbols ๐ฆ
โจ NAME โจ
nm โ list symbols from object files. that's it, that's the whole vibe. it opens up your object files and spills the tea on every symbol inside ๐
๐ SYNOPSIS ๐
nm [-A|-o|--print-file-name]
[-a|--debug-syms]
[-B|--format=bsd]
[-C|--demangle[=style]]
[-D|--dynamic]
[-fformat|--format=format]
[-g|--extern-only]
[-h|--help]
[--ifunc-chars=CHARS]
[-j|--format=just-symbols]
[-l|--line-numbers] [--inlines]
[-n|-v|--numeric-sort]
[-P|--portability]
[-p|--no-sort]
[-r|--reverse-sort]
[-S|--print-size]
[-s|--print-armap]
[-t radix|--radix=radix]
[-u|--undefined-only]
[-U|--defined-only]
[-V|--version]
[-W|--no-weak]
[-X 32_64]
[--no-demangle]
[--no-recurse-limit|--recurse-limit]]
[--plugin name]
[--size-sort]
[--special-syms]
[--synthetic]
[--target=bfdname]
[--unicode=method]
[--with-symbol-versions]
[--without-symbol-versions]
[objfile...]
๐ DESCRIPTION ๐
okay so GNU nm lists the symbols from object files objfile... and if you don't hand it any object files at all, it just assumes the file a.out and goes with it. no questions, no drama, just a.out ๐
for each symbol, nm shows you three little things:
- the symbol value, in whatever radix the options picked (more on that below), or hexadecimal by default โ hex is the default bestie, it's giving main character energy โจ
- the symbol type. at minimum these types get used, and others show up too depending on the object file format. lowercase = the symbol is usually local; uppercase = the symbol is global (external). but lowkey there are a few lowercase symbols that get shown for special global symbols (
u,vandw), so don't come for me ๐Aโ the symbol's value is absolute, and further linking will not change it. locked in, periodt.B/bโ the symbol is in the BSS data section. that section typically holds zero-initialized or uninitialized data, though the exact behavior is system dependent. iykyk.C/cโ the symbol is common. common symbols are uninitialized data. when linking, multiple common symbols can appear with the same name. if the symbol is defined anywhere, the common symbols get treated as undefined references. the lowercasecis used when the symbol lives in a special section for small commons ๐D/dโ the symbol is in the initialized data section.G/gโ the symbol is in an initialized data section for small objects. some object file formats let you access small data objects more efficiently, like a globalintvariable versus a big global array. tiny but mighty ๐iโ for PE format files this means the symbol is in a section specific to the implementation of DLLs.
for ELF format files this means the symbol is an indirect function. that's a GNU extension to the standard set of ELF symbol types. it flags a symbol which, if it's referenced by a relocation, does not evaluate to its address โ instead it must be invoked at runtime. the runtime execution then returns the value to be used in the relocation. so extra, honestly.
note โ the actual symbols displayed for GNU indirect symbols is controlled by the --ifunc-chars command line option. if that option has been provided, then the first character in the string gets used for global indirect function symbols. if the string contains a second character, that one gets used for local indirect function symbols ๐
Iโ the symbol is an indirect reference to another symbol.Nโ the symbol is a debugging symbol.nโ the symbol is in a non-data, non-code, non-debug read-only section.pโ the symbol is in a stack unwind section.R/rโ the symbol is in a read only data section.S/sโ the symbol is in an uninitialized or zero-initialized data section for small objects.T/tโ the symbol is in the text (code) section. the iconique code section ๐Uโ the symbol is undefined.uโ the symbol is a unique global symbol. that's a GNU extension to the standard set of ELF symbol bindings. for a symbol like this, the dynamic linker makes sure that across the entire process there is just one symbol with this name and type in use. one of one, no copies ๐ซถV/vโ the symbol is a weak object. when a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used and no error happens. when a weak undefined symbol is linked and the symbol isn't defined, the value of the weak symbol becomes zero with no error. on some systems, uppercase means a default value has been specified.W/wโ 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 and no error happens. when a weak undefined symbol is linked and the symbol isn't defined, the value of the symbol is determined in a system-specific manner, again with no error. on some systems, uppercase means a default value has been specified.-โ the symbol is a stabs symbol in ana.outobject file. in this case, the next values printed are the stabs other field, the stabs desc field, and the stab type. stabs symbols are the ones holding debugging information.?โ the symbol type is unknown, or it's object file format specific. mystery symbol, no cap ๐
- the symbol name. and if a symbol has version information associated with it, that version info gets displayed too. if the versioned symbol is undefined or hidden from the linker, the version string shows up as a suffix to the symbol name, preceded by an
@character โ for examplefoo@VER_1. if the version is the default version used when resolving unversioned references to the symbol, then it shows up as a suffix preceded by two@characters โ for examplefoo@@VER_2. double @ for the default one, that's the whole trick ๐
โจ OPTIONS โจ
okay bestie, so the long and short forms of options are literally equivalent โ they're shown here as alternatives, so pick whichever one slays for you ๐
-A,-o,--print-file-nameโ puts the name of the input file (or archive member ๐) in front of each symbol it was found in, instead of just naming the input file once at the top before all its symbols. iykyk, it's giving "label every single one."-a,--debug-symsโ shows all the symbols, even the debugger-only ones. normally those don't get listed, so this is the "no gatekeeping" mode ๐ซถ-Bโ literally the same as--format=bsd. it's just there for compatibility with the MIPSnm, periodt.-C,--demangle[=style]โ decodes (demangles!) those low-level symbol names into user-level names โจ besides stripping off any initial underscore that the system prepended, this makes C++ function names actually readable. different compilers use different mangling styles, so you can pass the optional demangling style argument to pick the right one for your compiler. it's giving translator-for-nerd-names.--no-demangleโ nope, don't demangle anything. this is the default, so if you do nothing, nothing gets prettified ๐--recurse-limit,--no-recurse-limit,--recursion-limit,--no-recursion-limitโ turns a limit on or off for how much recursion happens while demangling strings ๐ and here's the tea: name mangling formats allow for infinite levels of recursion, so it's genuinely possible to craft strings whose decoding will eat up all the stack space on the host machine and trigger a memory fault ๐ the limit tries to stop that by capping recursion at 2048 levels of nesting.
the limit is enabled by default, but you might have to disable it 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. so like, you were warned, bestie ๐ญ
-D,--dynamicโ shows the dynamic symbols instead of the normal ones. this is only meaningful for dynamic objects, like certain types of shared libraries ๐ฆ-fformat,--format=format โ use the output format format, which can be"bsd","sysv","posix"or"just-symbols". the default is"bsd". only the first character of format is significant โ and it can be upper or lower case, so don't stress about caps lock ๐-g,--extern-onlyโ only shows external symbols. the extroverts of the symbol world, essentially.-h,--helpโ shows a summary of the options fornmand dips. bye bestie ๐--ifunc-chars=CHARSโ when displaying GNU indirect function symbols,nmdefaults to using the"i"character for both local indirect functions and global indirect functions. this option lets you specify a string containing one or two characters: the first character gets used for global indirect function symbols, and the second character (if you give one) gets used for local indirect function symbols ๐-jโ literally the same as--format=just-symbols. iconic, minimal, no notes.-l,--line-numbersโ for each symbol, uses debugging information to try to find a filename and line number ๐ for a defined symbol, it looks for the line number of the address of the symbol. for an undefined symbol, it looks for the line number of a relocation entry that refers to the symbol. if line number info can be found, it gets printed after the other symbol information. it's giving receipts ๐--inlinesโ when-lis active and the address belongs to a function that was inlined, this option makes it print the source information for all the enclosing scopes back to the first non-inlined function too. for example: if"main"inlines"callee1"which inlines"callee2", and the address is from"callee2", then the source info for"callee1"and"main"will also be printed. full ancestry reveal ๐ธ-n,-v,--numeric-sortโ sorts symbols numerically by their addresses instead of alphabetically by their names. numbers era ๐ข-p,--no-sortโ doesn't bother sorting the symbols at all; prints them in the order encountered. chaos mode, honestly kind of freeing ๐-P,--portabilityโ uses the POSIX.2 standard output format instead of the default one. equivalent to-f posix. classic, standards-compliant, respectful ๐-r,--reverse-sortโ reverses the order of the sort (numeric or alphabetic, whichever you picked); let the last come first ๐-S,--print-sizeโ prints both the value and the size of defined symbols for the"bsd"output style. this option has no effect for object formats that don't record symbol sizes โ unless--size-sortis also used, in which case a calculated size gets displayed ๐งฎ-s,--print-armapโ when listing symbols from archive members, includes the index: a mapping (stored in the archive byarorranlib) of which modules contain definitions for which names. it's the archive's little contact list ๐-tradix,--radix=radix โ uses radix as the radix for printing symbol values. it must bedfor decimal,ofor octal, orxfor hexadecimal. that's the whole alphabet of options, bestie, don't try anything else ๐-u,--undefined-onlyโ only shows undefined symbols (those external to each object file). by default both defined and undefined symbols are displayed, so this is the "only the mysterious ones" filter ๐-U,--defined-onlyโ only shows defined symbols for each object file. again, by default both defined and undefined symbols are displayed. pick your fighter โ๏ธ-V,--versionโ shows the version number ofnmand exits. gotta know what you're working with โจ-Xโ this option is ignored, purely for compatibility with the AIX version ofnm. it takes one parameter which must be the string32_64. the default mode of AIXnmcorresponds to-X 32, which is not supported by GNUnm. so yeah, it's giving decorative ๐--pluginname โ loads the plugin called name to add support for extra target types. this option is only available if the toolchain has been built with plugin support enabled.
if --plugin isn't provided but plugin support has been enabled, then nm iterates over the files in ${libdir}/bfd-plugins in alphabetic order and the first plugin that claims the object in question gets used ๐
please note that this plugin search directory is not the one used by ld's -plugin option. in order to make nm use the linker plugin, it must be copied into the ${libdir}/bfd-plugins directory. for GCC based compilations the linker plugin is called liblto_plugin.so.0.0.0. for Clang based compilations it's called LLVMgold.so. the GCC plugin is always backwards compatible with earlier versions, so it's sufficient to just copy the newest one. slay, future-proof ๐
--size-sortโ sorts 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"bsd"output format is used, the size of the symbol is printed rather than the value โ and-Smust be used in order for both size and value to be printed ๐
note โ this option does not work if --undefined-only has been enabled, because undefined symbols have no size. they're literally sizeless, bestie, it's not their fault ๐ญ
--special-symsโ displays symbols that have a target-specific special meaning. these symbols are usually used by the target for some special processing, and they're 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 ๐--syntheticโ includes synthetic symbols in the output. these are special symbols created by the linker for various purposes, and they're not shown by default since they're not part of the binary's original source code. lore only the linker knows ๐ซถ--unicode=[default|invalid|locale|escape|hex|highlight]โ controls the display of UTF-8 encoded multibyte characters in strings. the default (--unicode=default) is to give them no special treatment.--unicode=localedisplays the sequence in the current locale, which may or may not support them.--unicode=hexand--unicode=invaliddisplay them as hex byte sequences enclosed by either angle brackets or curly braces.
--unicode=escape displays them as escape sequences (\uxxxx) and --unicode=highlight 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. red flag but make it aesthetic ๐ฅ
-W,--no-weakโ doesn't display weak symbols. no weak energy allowed here ๐ช--with-symbol-versions,--without-symbol-versionsโ enables or disables the display of symbol version information. the version string gets displayed as a suffix to the symbol name, preceded by an@character. for examplefoo@VER_1. if the version is the default version used when resolving unversioned references to the symbol, then it's displayed as a suffix preceded by two@characters โ for examplefoo@@VER_2. by default, symbol version information is displayed ๐ท๏ธ--target=bfdname โ specifies an object code format other than your system's default format. mix it up bestie ๐ฆ@file โ reads command-line options from file. the options read get inserted in place of the original@file option. if file doesn't exist, or can't be read, then the option is treated literally and not removed.
options in file 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 file may itself contain additional @file options โ and any such options will be processed recursively ๐ it's files all the way down, literally.
๐ธ SEE ALSO ๐ธ
ar(1), objdump(1), ranlib(1), and the Info entries for binutils. go read those next, bestie, they're the friend group ๐ซถ
๐ COPYRIGHT ๐
Copyright (c) 1991-2026 Free Software Foundation, Inc.
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". legal queen behavior, we love to see it ๐
and that's the whole page, bestie!! ๐
โจ this edition is from binutils-2.47, dated 2026-07-30 โ go off, nm(1) icon ๐๐ฆ๐
๐ฆ where this page comes from
- arch rolling: aarch64-linux-gnu-binutils 2.47-1 ยท GPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms