NM(1)

πŸ“¦
version 2.46.1 Β· 5 versions
, in fedora 44

🌸 NM(1) β€” the nm girlies' guide to listing symbols πŸ’…

GNU Development Tools ✨ nm(1)


πŸ’– NAME

nm β€” bestie, this lists symbols from object files. That's it, that's the whole job. πŸ‘‘


πŸŽ€ 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 ✨

So GNU nm lists the symbols from object files objfile... 🌈 And listen β€” if you pass it no object files at all, nm just assumes the file a.out. She's confident like that. πŸ’…

For every single symbol, nm shows you:

  • The symbol value, in the radix you picked with the options (keep reading, bestie, they're down below), or hexadecimal by default. πŸ”’
  • The symbol type. At least these types get used; there are others too, depending on the object file format. Here's the tea:
    • If it's lowercase, the symbol is usually local. If it's UPPERCASE, the symbol is global (external). 🫢 But β€” plot twist β€” there are a few lowercase symbols that show up for special global symbols, and those are "u", "v" and "w". Yes, they're lowercase AND global, they contain multitudes. πŸ’€
    • "A" β€” the symbol's value is absolute, and further linking will not change it. Locked in. πŸ”’
    • "B", "b" β€” the symbol lives in the BSS data section. That section is typically 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 may show up with the same name. If the symbol is defined anywhere, the common symbols get treated as undefined references. And the lowercase c character is used when the symbol is 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 allow more efficient access to small data objects β€” think a global int variable versus a huge global array. 🧚
    • "i" β€” okay so this one is a double agent, depends 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. It indicates a symbol which, if referenced by a relocation, does not evaluate to its address β€” instead it must be invoked at runtime. The runtime execution will then return the value to be used in the relocation. Main character energy fr fr. πŸ‘‘
      • > Heads up bestie: the actual symbols displayed for GNU indirect symbols is controlled by the --ifunc-chars command line option. If you've provided that option, the first character in the string gets used for global indirect function symbols. And if the string contains a second character, that one gets used for local indirect function symbols. Two characters, two jobs. πŸ’…
    • "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. Not like other sections. πŸ™ˆ
    • "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. smol but mighty. πŸŽ€
    • "T", "t" β€” the symbol is in the text (code) section. The code section!! She's the moment. πŸ”₯
    • "U" β€” the symbol is undefined. 😭
    • "u" β€” the symbol is a unique global symbol. This is a GNU extension to the standard set of ELF symbol bindings. For a symbol like this, the dynamic linker makes sure that in the entire process there is just one symbol with this name and type in use. Monogamy, but for symbols. πŸ’œ
    • "V", "v" β€” the symbol is a weak object. So here's how weak symbols work:
      • When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used, and there's 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.
    • "W", "w" β€” the symbol is a weak symbol that has not been specifically tagged as a weak object symbol. Same energy as above:
      • When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used, 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.
    • "-" β€” 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. πŸ•΅οΈ
    • "?" β€” the symbol type is unknown, or object file format specific. Mystery girl. πŸ’€
  • The symbol name. 🏷️ And if a symbol has version information associated with it, the version information gets displayed too:
    • 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: foo@VER_1.
    • If the version is the default version to be used when resolving unversioned references to the symbol, then it's displayed as a suffix preceded by two @ characters. For example: foo@@VER_2.

part 1 done, bestie β€” the options are coming up next πŸ’–

✨ OPTIONS ✨

okay bestie so real talk β€” the long and short forms of options are literally the same thing, just different fits. shown as alternatives, they're equivalent. pick whichever slays your fingers. πŸ’…


  • -A, -o, --print-file-name β€” puts the name of the input file (or archive member πŸ‘€) right before each symbol it was found in, instead of being like "hey here's the file" one single time before all its symbols. so it's per-symbol labelling, not a one-and-done intro.
  • -a, --debug-syms β€” shows you all the symbols, even the debugger-only ones. normally those are ghosted, not listed. not anymore. ✨
  • -B β€” the same as --format=bsd. it exists purely for compatibility with the MIPS nm. that's it. that's the whole vibe. πŸŽ€
  • -C, --demangle[=style] β€” decodes (demangles) low-level symbol names into names actual humans can read. besides stripping any initial underscore the system slapped on there, this makes C++ function names readable. different compilers mangle in different styles, and the optional demangling style argument lets you pick the right one for your compiler. genuinely life-changing tbh. 😭
  • --no-demangle β€” do NOT demangle low-level symbol names. this is the default, bestie. the raw chaotic energy is the baseline.
  • --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” turns a limit on recursion during demangling on or off. so here's the tea: name mangling formats allow for infinite levels of recursion, which means someone can craft strings whose decoding will straight-up exhaust the stack space on your host machine and trigger a memory fault. πŸ’€ the limit tries to stop that by restricting recursion to 2048 levels of nesting.

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. like, they will not be reading your email. so be mindful. 🫢

  • -D, --dynamic β€” displays the dynamic symbols instead of the normal ones. this only means anything for dynamic objects, like certain types of shared libraries. if your file isn't that, this option is just standing there. πŸ™ˆ
  • -f format, --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 matters, and it can be upper or lower case. so b, B, either way, iconic. πŸ‘‘
  • -g, --extern-only β€” only shows external symbols. that's the whole thing.
  • -h, --help β€” shows you a summary of the options for nm and exits. the classic "wait what does this do again" button.
  • --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 specify a string with one or two characters. the first character gets used for global indirect function symbols, and the second character (if you gave one) gets used for local indirect function symbols.
  • j β€” the same as --format=just-symbols. lowercase j, no dash, yes really, she's built different. πŸ¦‹
  • -l, --line-numbers β€” for each symbol, uses debugging info to try and 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 info.
  • --inlines β€” when -l is active, if the address belongs to a function that was inlined, this makes the source info for all enclosing scopes back to the first non-inlined function get printed too. for example: if "main" inlines "callee1" which inlines "callee2", and the address is from "callee2", then the source information for "callee1" and "main" will also be printed. it's giving ancestry reveal. 🌈
  • -n, -v, --numeric-sort β€” sorts symbols numerically by their addresses instead of alphabetically by their names. numbers over letters, periodt.
  • -p, --no-sort β€” doesn't bother sorting the symbols at all, in any order. just prints them in the order encountered. chaos mode, but the organized kind of chaos. ✨
  • -P, --portability β€” uses the POSIX.2 standard output format instead of the default. equivalent to -f posix.
  • -r, --reverse-sort β€” reverses the order of the sort (whether numeric or alphabetic). let the last come first. 😌
  • -S, --print-size β€” prints both value and 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-sort is 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 by ar or ranlib) of which modules contain definitions for which names. the receipts, basically. 🧾
  • *-t *radix, --radix=radix β€” uses radix as the radix for printing symbol values. it must be d for decimal, o for octal, or x for hexadecimal. three options, choose your fighter.
  • -u, --undefined-only β€” only displays undefined symbols (those external to each object file). by default both defined and undefined symbols are displayed.
  • -U, --defined-only β€” only displays defined symbols for each object file. by default both defined and undefined symbols are displayed.
  • -V, --version β€” shows the version number of nm and exits. the "who even are you" check. πŸ’–
  • -X β€” this option is ignored, 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 is not supported by GNU nm. so like, it's here, but it's not doing anything, bestie. πŸ’€
  • *--plugin *name β€” loads the plugin called name to add support for extra target types. this option is only available 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 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 is called LLVMgold.so. the GCC plugin is always backwards compatible with earlier versions, so it is sufficient to just copy the newest one. 🫢

  • --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 -S must 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 simply do not have one. 😭
  • --special-syms β€” displays symbols which have a target-specific special meaning. these 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.
  • --synthetic β€” includes synthetic symbols in the output. these are special symbols created by the linker for various purposes. they're not shown by default since they're not part of the binary's original source code. mystery symbols, now unmasked. πŸ”₯
  • --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=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 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. it's giving ⚠️ but make it fashion.

  • -W, --no-weak β€” does not display weak symbols. leave the weak behind. πŸ’…
  • --with-symbol-versions, --without-symbol-versions β€” 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 foo@VER_1. if the version is the default version to be 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. going your own way. ✨
  • @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; any such options will be processed recursively. it's files all the way down, bestie. πŸŒ€


🌸 SEE ALSO 🌸

ar(1), objdump(1), ranlib(1), and the Info entries for binutils. the whole friend group, go say hi. πŸ’–


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 one came to you courtesy of binutils-2.46.1, dated 2026-09-07 β€” go read your symbols, love u, bye!! πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from
  • fedora 44: cross-binutils-common 2.46.1-1.fc44 Β· GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms