NM(1)

πŸ¦‹ NM(1) πŸ¦‹

okay bestie, sit down, hydrate, because this is GNU Development Tools' very own nm(1) and she is that girl πŸ’…

πŸ’– NAME πŸ’–

nm β€” she lists symbols from object files. that's it. that's the whole job. and she ate. ✨


🌸 SYNOPSIS 🌸

lowkey this is the whole vibe right here, so imma put it down exactly:

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

periodt. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

so GNU nm lists the symbols from object files objfile... (yes plural, you can hand her a whole lil lineup of files 🫢).

and if you give her no object files at all? she just assumes the file a.out. no questions, no drama, she just goes. 😌


🌈 for each symbol, nm shows you: 🌈

  • πŸ’« The symbol value β€” printed in the radix you picked with the options (scroll down bestie, they're all there), or hexadecimal by default.
  • πŸ’« The symbol type. at least these ones get used β€” and honestly more too, it depends on the object file format, so it's giving "format girlies do their own thing". AND here's the key tea: if the letter is lowercase, the symbol is usually local; if it's UPPERCASE, the symbol is global (external). BUT β€” tiny plot twist β€” there are a few lowercase symbols that get shown for special global symbols, and those are "u", "v" and "w". iykyk. πŸ™ˆ
    • "A" β€” the symbol's value is absolute, and further linking will not change it. she said "im not moving". πŸ’…
    • "B", "b" β€” the symbol lives in the BSS data section. this section typically holds zero-initialized or uninitialized data, though the exact behavior is system dependent (ofc it is πŸ“).
    • "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 a heads up: the lowercase c character is used when the symbol is in a special section for small commons. cute AND specific. ✨
    • "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 permit more efficient access to small data objects β€” think a global int variable as opposed to a big ol' global array. tiny but mighty. 🧚
    • "i" β€” for PE format files this means the symbol is in a section specific to the implementation of DLLs. and for <lemon>ELF format files</lemon> β€” wait, let me use yellow β€” it means the symbol is an indirect function. this one 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. she's not a value, she's a process. πŸ‘‘
πŸ“Œ note bestie β€” the actual symbols display for GNU indirect symbols is controlled by the --ifunc-chars command line option. if this option has been provided, then the first character in the string will be used for global indirect function symbols. and if the string contains a second character, then that one will be used for local indirect function symbols. two characters, two jobs, she's booked and busy. πŸ’…
  • "I" β€” the symbol is an indirect reference to another symbol. (yes, a reference to a symbol. no cap.) 😭
  • "N" β€” the symbol is a debugging symbol. πŸ›
  • "n" β€” the symbol is in a non-data, non-code, non-debug read-only section. three no's and a yes. πŸ’€
  • "p" β€” the symbol is in a stack unwind section. she's letting go, gracefully. πŸƒ
  • "R", "r" β€” the symbol is in a read only data section. look, don't touch. πŸŽ€
  • "S", "s" β€” the symbol is in an uninitialized or zero-initialized data section for small objects. (yes, S/s is the small-object twin of B/b β€” the girlies are related. 🫢)
  • "T", "t" β€” the symbol is in the text (code) section. the main character section honestly. πŸ‘‘
  • "U" β€” the symbol is undefined. the void. the mystery. πŸ•³οΈ
  • "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. monogamy but for symbols. πŸ’œ
  • "V", "v" β€” the symbol is a weak object. so here's how that goes: 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. and on some systems, the uppercase indicates that a default value has been specified. soft girl, solid rules. 🌸
  • "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, 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. and on some systems, the uppercase indicates that a default value has been specified. (yes this is a near-twin to V/v, no they are not the same, pls don't merge them, i am begging πŸ₯Ί)
  • "-" β€” 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. vintage behavior, still iconic. πŸŽ€
  • "?" β€” the symbol type is unknown, or object file format specific. she said "idk her". πŸ’€
  • πŸ’« The symbol name. and β€” plot twist β€” 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 the linker, the version string is displayed as a suffix to the symbol name, preceded by an @ character. for example: foo@VER_1. πŸ’…
    • and 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. double @, main character energy, periodt. πŸ‘‘

🫢 bestie we are not done yet β€” the options and everything after are still coming, so don't you dare close the terminal. ✨

✨ OPTIONS ✨

okay bestie, so the long and short forms of options are literally interchangeable β€” pick whichever vibe you want, they do the exact same thing. πŸ’…

  • -A, -o, --print-file-name β€” puts the name of the input file (or archive member) it found the symbol in right before each symbol, instead of just naming the input file once at the top before all its symbols. no cap, it's a whole per-symbol label moment 🏷️
  • -a, --debug-syms β€” shows all the symbols, even the debugger-only ones. normally those don't show up at all, so this is giving "let me see everything" energy πŸ”
  • -B β€” the same as --format=bsd, and it only exists for compatibility with the MIPS nm. that's it, that's the whole option 🫢
  • -C, --demangle[=style] β€” decodes (demangles) those low-level symbol names back into user-level names. besides stripping any initial underscore the system slapped on, this makes C++ function names actually readable. different compilers have different mangling styles, and the optional demangling style argument lets you pick the right one for your compiler. it's giving "translating the alien language" πŸ‘‘βœ¨
  • --no-demangle β€” does not demangle low-level symbol names. this is the default, so if you do nothing, this is your vibe.
  • --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” turns a limit on recursion while demangling on or off. real talk: since the name mangling formats allow infinite recursion, it's possible to create strings whose decoding will exhaust all the stack space on your host machine and trigger a memory fault. the limit tries to prevent that by restricting recursion to 2048 levels of nesting.
the default is for this limit to be enabled, but disabling it may be needed to demangle truly complicated names. but bestie hear me: if the recursion limit is disabled, stack exhaustion is possible, and any bug reports about such an event will be rejected. no cap. πŸ’€
  • -D, --dynamic β€” displays the dynamic symbols instead of the normal symbols. this is only meaningful for dynamic objects, like certain types of shared libraries. very "specific to that one thing" of it πŸ¦‹
  • -f format, --format=format β€” uses 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 like, first letter, that's the whole assignment πŸ“
  • -g, --extern-only β€” displays only external symbols. narrowing it down bestie ✨
  • -h, --help β€” shows a summary of the options for nm and exits. your little study guide πŸŽ€
  • --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 containing one or two characters. the first character gets used for global indirect function symbols, and the second character (if present) gets used for local indirect function symbols. custom letters, main character energy πŸ‘‘
  • -j β€” the same as --format=just-symbols. simple, iconic.
  • -l, --line-numbers β€” for each symbol, tries to find a filename and line number using debugging information. 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 prints it after the other symbol info. detective work fr fr πŸ•΅οΈ
  • --inlines β€” when option -l is active, if the address belongs to a function that was inlined, this option makes the source information 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 get printed. it's giving "show me the whole family tree" 🌳
  • -n, -v, --numeric-sort β€” sorts symbols numerically by their addresses, instead of alphabetically by their names. number vibes πŸ”’
  • -p, --no-sort β€” doesn't bother sorting the symbols in any order at all; just prints them in the order encountered. chaotic, no notes πŸ’…
  • -P, --portability β€” uses the POSIX.2 standard output format instead of the default format. equivalent to -f posix. standards girlie 🌸
  • -r, --reverse-sort β€” reverses the order of the sort (whether numeric or alphabetic); let the last come first. last-place slay πŸ™ˆ
  • -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 is displayed. facts only.
  • -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. receipts, basically 🧾
  • -t radix, --radix=radix β€” uses radix as the radix for printing the symbol values. it must be d for decimal, o for octal, or x for hexadecimal. pick your number system bestie ✨
  • -u, --undefined-only β€” displays only undefined symbols (those external to each object file). by default both defined and undefined symbols are displayed.
  • -U, --defined-only β€” displays only 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 am I" option πŸ’–
  • -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, just let it be 😌
  • --plugin name β€” 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 is not 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 is used.

heads up bestie: this plugin search directory is not the one used by ld's -plugin option. 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, since undefined symbols have no size. periodt. πŸ’€
  • --special-syms β€” displays symbols which have a target-specific special meaning. these symbols are usually used by the target for some special processing and aren't 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. special lil guys ✨
  • --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. fake but make it functional πŸ’…
  • --unicode=[default|invalid|locale|escape|hex|highlight] β€” controls the display of UTF-8 encoded multibyte characters in strings. the default (--unicode=default) gives them no special treatment. the --unicode=locale option displays the sequence in the current locale, which may or may not support them. the options --unicode=hex and --unicode=invalid display them as hex byte sequences enclosed by either angle brackets or curly braces.

the --unicode=escape option displays them as escape sequences (\uxxxx), and the --unicode=highlight 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. 🌈✨

  • -W, --no-weak β€” does not display weak symbols. if they can't handle it, they don't get shown πŸ™ˆ
  • --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. double @ = default, iykyk πŸ‘‘
  • --target=bfdname β€” specifies an object code format other than your system's default format.
  • @file β€” reads command-line options from file. the options read are inserted in place of the original @file option. if file does not exist, or cannot be read, then the option will be 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 giving inception bestie πŸŒ€


🌸 SEE ALSO 🌸

go read ar(1), objdump(1), ranlib(1), and the Info entries for binutils. the whole squad 🫢✨


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


okay bestie, that's the whole page πŸ’– this lil masterpiece is from binutils-2.47, dated 2026-09-19, and it lives at NM(1). now go forth and read some symbols, you icon πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from