NM(1)
π nm(1) β the manual page, but make it cute
okay bestie, gather round, because today we're talking about nm β the GNU Development Tools girlie whose whole entire job is listing symbols from object files. she's giving detective energy, she's giving x-ray vision, she's the friend who can tell you exactly what's inside a binary. π
β¨ NAME β¨
nm</purpose> β list symbols from object files. that's it, that's the gig. π«Ά
πΈ SYNOPSIS πΈ
nm [-aβͺ--debug-syms] [-gβͺ--extern-only]
[-B] [-Cβͺ--demangle[=style]] [-Dβͺ--dynamic]
[-Sβͺ--print-size] [-sβͺ--print-armap]
[-Aβͺ-oβͺ--print-file-name][--special-syms]
[-nβͺ-vβͺ--numeric-sort] [-pβͺ--no-sort]
[-rβͺ--reverse-sort] [--size-sort] [-uβͺ--undefined-only]
[-t radixβͺ--radix=radix] [-Pβͺ--portability]
[--target=bfdname] [-fformatβͺ--format=format]
[--defined-only] [-lβͺ--line-numbers] [--no-demangle]
[-Vβͺ--version] [-X 32_64] [--help] [objfile...]
no cap, that's a LOT of options. she contains multitudes. π
π¦ DESCRIPTION π¦
GNU nm lists the symbols from object files objfile... and if you don't hand her any object files as arguments? she just assumes the file a.out. assuming things, iconic behavior honestly. π
so for each and every symbol, nm shows you:
- the symbol value, in whatever radix you picked with options (scroll down, bestie), or hexadecimal by default.
- the symbol type. at least the following types are used; others are used too, depending on the object file format. and here's the vibe check: if it's lowercase, the symbol is local; if it's uppercase, the symbol is global (external). lowercase = keeps to herself, uppercase = main character.
- the symbol name. obviously. π
π€ the symbol types, alphabetized and annotated π€
"A"β the symbol's value is absolute, and will not be changed by further linking. she's decided, she's not moving, periodt."B"β the symbol is in the uninitialized data section (known as BSS)."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."D"β the symbol is in the initialized data section."G"β the symbol is in an initialized data section for small objects. some object file formats permit more efficient access to small data objects, like a globalintvariable as opposed to a large global array. tiny but mighty π"I"β the symbol is an indirect reference to another symbol. this is a GNU extension to the a.out object file format which is rarely used. rare queen."N"β the symbol is a debugging symbol."R"β the symbol is in a read only data section."S"β the symbol is in an uninitialized data section for small objects."T"β the symbol is in the text (code) section. T for text, T for the blueprint of the whole thing."U"β the symbol is undefined. π"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."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."-"β 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. mysterious. we love a lil enigma. β¨
π OPTIONS π
the long and short forms of options, shown here as alternatives, are equivalent. pick your fave, bestie, they're the same thing wearing different outfits.
-A,-o,--print-file-nameβ precede each symbol by the name of the input file (or archive member) in which it was found, rather than identifying the input file once only, before all of its symbols. like a lil name tag on every single symbol π·οΈ-a,--debug-symsβ display all symbols, even debugger-only symbols; normally these are not listed. she's showing you the group chat with the read receipts.-Bβ the same as--format=bsd(for compatibility with the MIPSnm).-C,--demangle[=style]β decode (demangle) low-level symbol names into user-level names. besides removing any initial underscore prepended by the system, this makes C++ function names readable. different compilers have different mangling styles. the optional demangling style argument can be used to choose an appropriate demangling style for your compiler. translating from robot to human, obsessed π§--no-demangleβ do not demangle low-level symbol names. this is the default.-D,--dynamicβ display the dynamic symbols rather than the normal symbols. this is only meaningful for dynamic objects, such as certain types of shared libraries.-fformat,--format=format β use the output format format, which can be"bsd","sysv", or"posix". the default is"bsd". only the first character of format is significant; it can be either upper or lower case. one letter and she gets it, lowkey efficient.-g,--extern-onlyβ display only external symbols. no locals, no inside thoughts.-l,--line-numbersβ for each symbol, use debugging information to try to find a filename and line number. for a defined symbol, look for the line number of the address of the symbol. for an undefined symbol, look for the line number of a relocation entry which refers to the symbol. if line number information can be found, print it after the other symbol information. she's giving you the receipts AND the timestamp.-n,-v,--numeric-sortβ sort symbols numerically by their addresses, rather than alphabetically by their names.-p,--no-sortβ do not bother to sort the symbols in any order; print them in the order encountered. chaos mode, honestly valid.-P,--portabilityβ use the POSIX.2 standard output format instead of the default format. equivalent to-f posix.-S,--print-sizeβ print size, not the value, of defined symbols for the"bsd"output format.-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. it's the archive's lil table of contents π-r,--reverse-sortβ reverse the order of the sort (whether numeric or alphabetic); let the last come first. she's not like other sorts π--size-sortβ sort symbols by size. the size is 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-Smust be used in order both size and value to be printed.--special-symsβ display symbols which have a target-specific special meaning. these symbols 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.-tradix,--radix=radix β use radix as the radix for printing the symbol values. it must bedfor decimal,ofor octal, orxfor hexadecimal.--target=bfdname β specify an object code format other than your system's default format.-u,--undefined-onlyβ display only undefined symbols (those external to each object file).--defined-onlyβ display only defined symbols for each object file.-V,--versionβ show the version number ofnmand exit.-Xβ this option is ignored 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 is not supported by GNUnm.--helpβ show a summary of the options tonmand exit. the lil cheat sheet π
π SEE ALSO π
ar(1), objdump(1), ranlib(1), and the Info entries for binutils.
go say hi to the rest of the friend group, they're all iconic. π
π COPYRIGHT π
Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 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.1 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 thing, bestie! π«Ά this page comes to you from binutils-2.15.97, dated 2005-04-20 β vintage, retro, still slaying. mwah. πβ¨
π¦ where this page comes from
- debian bookworm: binutils-h8300-hms 2.16.1-10+b2
- debian trixie: binutils-h8300-hms 2.16.1-13
- ubuntu jammy: binutils-h8300-hms 2.16.1-10build1
- ubuntu noble: binutils-h8300-hms 2.16.1-10build1
- ubuntu resolute: binutils-h8300-hms 2.16.1-15
- ubuntu stonking: binutils-h8300-hms 2.16.1-15
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms