NM(1)

πŸŽ€ NM(1) πŸŽ€

okay bestie, gather round, because we're talking about nm β€” it's part of the GNU Development Tools crew, it lives in section 1 of the manual (iykyk), and it is genuinely so useful it's not even funny. ✨


πŸ’– NAME πŸ’–

nm β€” lists symbols from object files. that's the whole job. it peeks inside your object files and tells you what's in there. iconic behavior, no notes. πŸ‘‘


🌸 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...]

(yes the brackets really do look like that, don't @ me, that's just the vibe it's giving πŸ’…)


✨ DESCRIPTION ✨

GNU nm lists the symbols from object files objfile... and if you're sitting there like "bestie I didn't give you any files", it just assumes the file a.out. so casual. so confident. 🫢

So for each and every symbol, nm shows you:

  • The symbol value β€” in whatever radix you picked with the options (scroll down, they're coming πŸ’œ), or hexadecimal by default.
  • The symbol type.
  • The symbol name.

and if a symbol has version info attached, that shows up too β€” more on that at the bottom of this section. πŸ‘‡


🌈 the symbol types, aka the alphabet lore

okay so at least the following types get used. others exist too, depending on what object file format you're dealing with, because of course they do. 😭

the big rule: if it's lowercase, the symbol is usually local. if it's uppercase, the symbol is global (external). but β€” and this is the plot twist β€” there are a few lowercase symbols that show up for special global symbols: u, v and w. not me exposing the exceptions fr fr. πŸ’€

  • A β€” the symbol's value is absolute and will not be changed by further linking. locked in. periodt.
  • B, b β€” the symbol lives in the BSS data section. that section typically holds zero-initialized or uninitialized data, though the exact behavior is system dependent (so don't come for me).
  • C, c β€” the symbol is common. common symbols are uninitialized data. when you're linking, multiple common symbols can show up with the same name. if the symbol is defined anywhere, the common symbols get treated as undefined references. lowercase c is what you get 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 β€” think a global int variable versus a giant global array.
  • i β€” two completely different meanings depending on the format:
    • 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. this is a GNU extension to the standard set of ELF symbol types, and here's the tea: it marks a symbol which, if referenced by a relocation, does not evaluate to its address β€” instead it has to be invoked at runtime. the runtime execution then returns the value to be used in the relocation.
    • πŸ“Œ note: the actual symbols displayed for GNU indirect symbols is controlled by the --ifunc-chars command line option. if you pass that option, the first character in the string is used for global indirect function symbols, and if the string has a second character, that one is 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. a whole mouthful, but okay.
  • 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 main character of sections, arguably. πŸŽ€
  • U β€” the symbol is undefined.
  • u β€” the symbol is a unique global symbol. this one is 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. πŸ’…
  • V, v β€” the symbol is a weak object. when a weak defined symbol gets linked with a normal defined symbol, the normal defined symbol wins with no error. when a weak undefined symbol gets linked and the symbol isn't defined, the value of the weak symbol becomes zero with no error. on some systems, the 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. same deal: weak defined + normal defined β†’ normal defined wins, no error. weak undefined + symbol not defined β†’ the value of the symbol is determined in a system-specific manner, without error. and again, on some systems the uppercase means a default value has been specified.
  • - β€” 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 how debugging information gets held. retro of them. πŸ¦‹
  • ? β€” the symbol type is unknown, or it's specific to the object file format. the mystery box of symbol types. πŸ“

🧚 and then there's the name part 🧚

The symbol name, obviously. but plot twist β€” if a symbol has version information associated with it, that version information 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 a single @ character. for example, foo@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 example, foo@@VER_2.

(one @ vs two @ β€” that's the whole difference, so read carefully bestie 😭)

✨ OPTIONS ✨

Okay bestie, here's the tea β˜• β€” the long and short forms of options, shown here as alternatives, are equivalent. So pick whichever one vibes with you πŸ’–

  • -A, -o, --print-file-name β€” Slap the name of the input file (or archive member) where the symbol was found in front of every single symbol 🏷️, instead of just naming the input file once at the top before all its symbols. One label per symbol, no sharing, main character energy.
  • -a, --debug-syms β€” Show all the symbols, even the debugger-only ones. Normally those don't get an invite to the party πŸ™ˆ.
  • -B β€” Literally just the same as --format=bsd (it's there so it plays nice with the MIPS nm). Bestie is nostalgic πŸ’…
  • -C, --demangle[=style] β€” Decodes (demangles) those crusty low-level symbol names into cute user-level names ✨. On top of stripping any initial underscore the system prepended, it makes C++ function names actually readable. Different compilers mangle in different styles, so the optional demangling style argument lets you pick the right one for your compiler.
  • --no-demangle β€” Do not demangle low-level symbol names. This is the default, no cap 🫢.
  • --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” Turns a limit on recursion during demangling on or off. Here's the thing πŸ‘€: name mangling formats allow infinite recursion, so it's genuinely possible to build strings whose decoding eats up all the stack space on your machine, which triggers a memory fault 😭. The limit tries to stop that by capping recursion at 2048 levels of nesting.

The default is that this limit is enabled, but disabling it may be necessary if you need to demangle truly complicated names. But heads up 🚨 β€” if you disable the recursion limit, stack exhaustion is possible, and any bug reports about that will be rejected. Not me warning you twice, fr fr.

  • -D, --dynamic β€” Show the dynamic symbols instead of the normal ones. This only means anything for dynamic objects, like certain types of shared libraries πŸ¦‹.
  • -f format, --format=format β€” Use the output format format, which can be "bsd", "sysv", "posix" or "just-symbols". Default is "bsd" πŸ’–. Only the first character of format is significant, and it can be upper or lower case.
  • -g, --extern-only β€” Only show external symbols. Outsiders only πŸ”₯.
  • -h, --help β€” Show a lil summary of the nm options and exit. Your rescue bestie 🫢.
  • --ifunc-chars=CHARS β€” When displaying GNU indirect function symbols, nm defaults to using the "i" character for both local indirect functions and global indirect functions. This option lets you hand it a string with one or two characters. The first character gets used for global indirect function symbols, and the second character β€” if you even gave one β€” gets used for local indirect function symbols ✨.
  • -j β€” Same as --format=just-symbols. Just vibes, just symbols πŸ’….
  • -l, --line-numbers β€” For each symbol, use debugging info to try to find a filename and line number. For a defined symbol, look for the line number of the symbol's address. For an undefined symbol, look for the line number of a relocation entry that refers to the symbol. If line number info turns up, print it after the other symbol info πŸ“.
  • --inlines β€” When -l is active and the address belongs to a function that was inlined, this makes the source info for all the enclosing scopes get printed too, all the way back to the first non-inlined function 🧚. Example: if "main" inlines "callee1" which inlines "callee2", and the address is from "callee2", then the source info for "callee1" and "main" gets printed as well. The whole family tree, iconic.
  • -n, -v, --numeric-sort β€” Sort symbols numerically by their addresses instead of alphabetically by their names πŸ”’.
  • -p, --no-sort β€” Don't even bother sorting the symbols, bestie. Just print them in the order you ran into them, chaotic and free 🌈.
  • -P, --portability β€” Use the POSIX.2 standard output format instead of the default. Equivalent to -f posix πŸ‘‘.
  • -r, --reverse-sort β€” Flip the sort order (numeric or alphabetic, whichever you picked). Last one comes first πŸ’€.
  • -S, --print-size β€” Print both the value and the size of defined symbols for the "bsd" output style. This option does nothing for object formats that don't record symbol sizes β€” unless --size-sort is also used, in which case a calculated size gets displayed πŸ‘€.
  • -s, --print-armap β€” When listing symbols from archive members, include the index: a mapping (stored in the archive by ar or ranlib) of which modules contain definitions for which names πŸ“š.
  • -t radix, --radix=radix β€” Use radix as the radix for printing symbol values. It has to be d for decimal, o for octal, or x for hexadecimal πŸ”’.
  • -u, --undefined-only β€” Only show undefined symbols (the ones external to each object file). By default both defined and undefined symbols get shown 🫢.
  • -U, --defined-only β€” Only show defined symbols for each object file. Again, by default both defined and undefined symbols get shown βœ….
  • -V, --version β€” Show the version number of nm and exit πŸŽ€.
  • -X β€” This one is ignored, purely for compatibility with the AIX version of nm. It takes one parameter, which must be the string 32_64. The default mode of AIX nm corresponds to -X 32, which GNU nm does not support πŸ™…β€β™€οΈ.
  • --plugin name β€” Load the plugin called name to add support for extra target types. This option only exists if the toolchain was 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 wins πŸ†.

Please note that this plugin search directory is not the one used by ld's -plugin option. To get nm to use the linker plugin, it has to 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 just copying the newest one is enough πŸ’….

  • --size-sort β€” Sort symbols by size πŸ“. For ELF objects, symbol sizes are read straight from the ELF; for other object types the sizes are computed as the difference between the symbol's value and the value of the symbol with the next higher value. If the "bsd" output format is used, the size of the symbol gets printed rather than the value, and -S must be used for both size and value to show up.

Note β€” this option does not work if --undefined-only has been enabled, because undefined symbols have no size. Physics says no, bestie 🚫.

  • --special-syms β€” Display symbols that have a target-specific special meaning πŸ‘‘. These are usually used by the target for some special processing and aren't normally helpful 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 β€” Include synthetic symbols in the output πŸ§ͺ. These are special symbols the linker creates for various purposes, and they're not shown by default since they aren't part of the binary's original source code.
  • --unicode=[default|invalid|locale|escape|hex|highlight] β€” Controls how UTF-8 encoded multibyte characters get displayed in strings πŸ¦‹. The default (--unicode=default) gives them no special treatment. --unicode=locale displays the sequence in the current locale, which may or may not support them. --unicode=hex and --unicode=invalid display them as hex byte sequences wrapped in 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 the output device supports it). The colouring is meant to draw attention to unicode sequences hanging out where you might not expect them πŸ‘€.

  • -W, --no-weak β€” Don't display weak symbols. Stand up, bestie πŸ’ͺ.
  • --with-symbol-versions, --without-symbol-versions β€” Enables or disables the display of symbol version information 🏷️. The version string shows up as a suffix on the symbol name, preceded by an @ character. For example foo@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 example foo@@VER_2. By default, symbol version information is displayed.
  • --target=bfdname β€” Specify an object code format other than your system's default format 🎯.
  • @file β€” Read command-line options from file. The options that get read are inserted in place of the original @file option πŸ“„. If file doesn't exist, or can't be read, then the option gets treated literally and is not removed.

Options inside file are separated by whitespace. A whitespace character can be included in an option by wrapping the whole option in either single or double quotes. Any character (even a backslash) can be included by prefixing that character with a backslash. And the file can itself contain additional @file options β€” those get processed recursively πŸŒ€.


πŸ‘€ SEE ALSO πŸ‘€

ar(1), objdump(1), ranlib(1), and the Info entries for binutils. Go read those next, bestie, we love a well-rounded education πŸ’–


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".


And that's the whole page, bestie!! πŸŽ€βœ¨ This was binutils-2.47, dated 2026-09-05, and it officially lives at NM(1). You understood every single flag, you ate, no crumbs left πŸ’…πŸ‘‘πŸ«Ά

πŸ“¦ where this page comes from