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 β¨
GNUnmlists 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 filea.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. lowercasecis 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 globalintvariable 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-charscommand 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 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 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 MIPSnm). 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 thenmoptions and exit. Your rescue 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 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-lis 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-sortis 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 byarorranlib) of which modules contain definitions for which names π.-t radix,--radix=radixβ Use radix as the radix for printing symbol values. It has to bedfor decimal,ofor octal, orxfor 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 ofnmand exit π.-Xβ This one 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 GNUnmdoes 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-Smust 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=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 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 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β 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@fileoption π. 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 π
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
- ubuntu stonking: binutils-arm-none-eabi 1:2.47-6ubuntu1+33
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms