NM(1)
π¦ NAME π¦
nm β list symbols from object files β¨
(yes bestie, this is the NM(1) page from the GNU Development Tools set β welcome, you're in the right group chat π)
πΈ 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... . That's the whole thing. That's her job πββοΈ
And if you don't pass any object files as arguments at all? She just assumes the file a.out. no cap, she's got a default, she's lowkey self-sufficient like that.
For each symbol, nm shows you:
- The symbol value, in the radix selected by options (see below), or hexadecimal by default. It's giving "here's the number bestie" β¨
- The symbol type. At least the following types are used β others are too, depending on the object file format. So like, lowercase usually means the symbol is local, uppercase means it's global (external). But there are a few lowercase symbols that get shown for special global symbols (
"u","v"and"w") β those are the exceptions, the little rebels πAβ the symbol's value is absolute, and further linking will not change it. Locked in. Immovable. Queen behaviour πB,bβ the symbol is in the BSS data section. That section typically contains zero-initialized or uninitialized data, although the exact behavior is system dependent. So likeβ¦ it depends, iykyk.C,cβ 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 caseccharacter is used when the symbol is in a special section for small commons. Tiny commons, iconic πD,dβ the symbol is in the initialized data section. Initialized. Ready. Put together. Main character energy π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, such as a globalintvariable as opposed to a large global array. Small but mighty πiβ for PE format files this indicates that the symbol is in a section specific to the implementation of DLLs.
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.
Note β 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. If the string contains a second character then that will be used for local indirect function symbols. Two characters, two jobs, she's flexible like that π
Iβ the symbol is an indirect reference to another symbol. Not the symbol itself, just pointing at one. It's giving "check her instead" π«ΆNβ the symbol is a debugging symbol. πβ¨nβ the symbol is in a non-data, non-code, non-debug read-only section. So basically none of the things. Just vibes.pβ the symbol is in a stack unwind section.R,rβ the symbol is in a read only data section. Look but don't touch π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 actual code bestie!! π₯Uβ the symbol is undefined. She's just a concept rn π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. One of one. Exclusive. No duplicates allowed β¨π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 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. Weak but never messy πΈ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. On some systems, uppercase indicates that a default value has been specified. Different flavour of weak, same soft launch energy π-β 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. Three extra values, she's thorough, she's not doing anything halfway π?β the symbol type is unknown, or object file format specific. Mystery girl. We don't know her and honestly neither doesnmπ
- 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 examplefoo@VER_1. 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 examplefoo@@VER_2. One@or two@, that's the whole plot twist and it MATTERS bestie, do not skim it π€
β¨ OPTIONS β¨
okay bestie, one thing before we get into it: the long form and the short form of every option down here are literally the same thing. same behaviour, just a different amount of typing. pick whichever one makes your fingers happy π
-A,-o,--print-file-nameβ slaps the name of the input file (or the archive member) in front of every single symbol it found in there, instead of naming the file just once up top before all of its symbols. it's giving individual name tags instead of one group label β¨-a,--debug-symsβ shows all the symbols, even the debugger-only ones. normally those get left out of the party entirely π-Bβ same as--format=bsd(this one exists purely so it plays nice with the MIPSnm).-C,--demangle[=style]β decodes (demangles) those low-level symbol names back into human-readable, user-level names. it also strips off any leading underscore the system glued on, and it makes C++ function names actually make sense. different compilers mangle in different styles, so you can optionally hand it a demangling style argument to pick the right one for your compiler π--no-demangleβ do not demangle low-level symbol names. this is the default, bestie.--recurse-limit,--no-recurse-limit,--recursion-limit,--no-recursion-limitβ turns a limit on recursion during demangling on or off. here's the tea: the name mangling formats allow infinite recursion, so it's totally possible to build strings whose decoding will gobble up every last bit of stack space on your machine and trigger a memory fault π the limit exists to stop that by capping recursion at 2048 levels of nesting.
it's enabled by default, but you might need to disable it to demangle truly complicated names.
bestie listen β if you disable the recursion limit, stack exhaustion is genuinely possible, and any bug report about that happening will be rejected. you have been warned π
-D,--dynamicβ shows the dynamic symbols instead of the normal ones. this only means anything for dynamic objects, like certain types of shared libraries π-fformat,--format=format β use output format format, which can be"bsd","sysv","posix"or"just-symbols". the default is"bsd". only the first character of format actually matters, and it can be upper or lower case πΈ-g,--extern-onlyβ only shows external symbols, nothing else.-h,--helpβ shows a summary of the options fornmand dips π«Ά--ifunc-chars=CHARSβ when showing GNU indirect function symbols,nmdefaults to using the"i"character for both local indirect functions and global indirect functions. this option lets you hand over a string with one or two characters: the first gets used for global indirect function symbols, and the second one (if you gave one) gets used for local indirect function symbols β¨-jβ same as--format=just-symbols.-l,--line-numbersβ for each symbol, it uses debugging info to try to find a filename and line number. for a defined symbol it looks for the line number of the symbol's address; for an undefined symbol it looks for the line number of a relocation entry that refers to the symbol. if it finds line number info, it prints it after the other symbol info π--inlinesβ when-lis active, if the address belongs to a function that got inlined, this makes it print the source info for all the enclosing scopes all the way back to the first non-inlined function too. like, 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. it's giving receipts all the way up the chain π-n,-v,--numeric-sortβ sorts symbols numerically by their addresses instead of alphabetically by their names π-p,--no-sortβ don't bother sorting the symbols into any order at all; just print them in the order you encountered them.-P,--portabilityβ uses the POSIX.2 standard output format instead of the default one. equivalent to-f posixβ-r,--reverse-sortβ flips the sort order around (whether it's numeric or alphabetic). last comes first, bestie π-S,--print-sizeβ prints 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-sortis also in play, in which case a calculated size gets displayed instead π-s,--print-armapβ when listing symbols from archive members, this includes the index: that's a mapping (stored in the archive byarorranlib) of which modules contain definitions for which names π-tradix,--radix=radix β uses radix as the radix for printing symbol values. it has to bedfor decimal,ofor octal, orxfor hexadecimal. no other letters, bestie, it will not accept your vibes π’-u,--undefined-onlyβ shows only undefined symbols (the ones external to each object file). by default both defined and undefined symbols get displayed.-U,--defined-onlyβ shows only defined symbols for each object file. by default both defined and undefined symbols get displayed.-V,--versionβ shows the version number ofnmand exits π-Xβ this one is just ignored, kept around 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, and GNUnmdoes not support that π«--pluginname β loads the plugin called name to add support for extra target types. this option only exists if your toolchain was built with plugin support enabled.
if --plugin isn't given but plugin support is 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.
heads up bestie: this plugin search directory is not the same one thatld's-pluginoption uses. to makenmuse the linker plugin, you have to copy it into the${libdir}/bfd-pluginsdirectory. for GCC based compilations the linker plugin is calledliblto_plugin.so.0.0.0. for Clang based compilations it's calledLLVMgold.so. the GCC plugin is always backwards compatible with earlier versions, so just copying the newest one is enough π
--size-sortβ sorts symbols by size. for ELF objects the symbol sizes are read straight from the ELF; for other object types the sizes get 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 gets printed rather than the value, and-Smust be used if you want both size and value printed together.
note β this option does not work if --undefined-only has been enabled, because undefined symbols have no size π
--special-symsβ displays symbols that have a target-specific special meaning. these symbols are usually used by the target for some special processing and aren't normally helpful when they show up 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 the linker created 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 in strings get displayed. the default (--unicode=default) is to give them no special treatment at all.--unicode=localedisplays the sequence in the current locale, which may or may not support them.--unicode=hexand--unicode=invaliddisplay 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 your output device supports it). the colouring is meant to draw attention to unicode sequences showing up where you might not expect them π
-W,--no-weakβ does not display weak symbols. they're just not invited π«--with-symbol-versions,--without-symbol-versionsβ turns the display of symbol version information on or off. the version string shows up as a suffix on 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 shown 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.@file β reads command-line options from file. the options that get read are inserted right in place of the original@file option. if file doesn't exist, or can't be read, then the option gets treated literally and isn't removed.
options inside file are separated by whitespace. a whitespace character can be included in an option by wrapping the entire option in either single or double quotes. any character (including a backslash) can be included by prefixing the character you want with a backslash. and file may itself contain additional @file options β any of those get processed recursively, bestie, it's files all the way down π
πΈ SEE ALSO πΈ
ar(1)objdump(1)ranlib(1)- and the Info entries for
binutilsπ
π 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".
and that's a wrap, bestie π this whole lil masterpiece is from binutils-2.47, dated 2026-09-12 β go forth and demangle your symbols with main character energy β¨π
π¦ where this page comes from
- ubuntu stonking: binutils-bpf 2.47-6ubuntu1+2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms