LLVM-NM(1)

✨ NAME ✨

okay so welcome to the LLVM-NM(1) page bestie πŸ’– β€” llvm-nm lists the symbol table of LLVM bitcode and object files. that's it, that's the job. she's a snoop, she's a gossip, she tells you who's in the file.


πŸ¦‹ SYNOPSIS πŸ¦‹

llvm-nm [options] [filenames...]

🌸 DESCRIPTION 🌸

so the llvm-nm utility lists the names of symbols from LLVM bitcode files, object files, and archives. every symbol gets listed along with some simple info about its provenance, like a lil name tag at a party πŸŽ€. if you don't specify a filename, a.out is the input (default queen behavior). and if you use - as a filename, llvm-nm will read a file from its standard input stream. slay.

llvm-nm's default output format is the traditional BSD nm output format. each such output record is made of an (optional) 8-digit hexadecimal address, then a type code character, then a name, for each symbol. one record per line; fields are separated by spaces. when the address is omitted, it's replaced by 8 spaces (not me counting the spaces, but yes, 8 of them πŸ’…).

the supported type code characters are as follows. where both lower and upper-case characters are listed for the same meaning, a lower-case character represents a local symbol, whilst an upper-case character represents a global (external) symbol:

  • a, A β€” absolute symbol.
  • b, B β€” uninitialized data (bss) object.
  • C β€” common symbol. multiple definitions link together into one definition.
  • d, D β€” writable data object.
  • i, I β€” COFF: .idata symbol or symbol in a section with IMAGE_SCN_LNK_INFO set.
  • n β€” ELF: local symbol from non-alloc section. COFF: debug symbol.
  • N β€” ELF: debug section symbol, or global symbol from non-alloc section.
  • s, S β€” COFF: section symbol. Mach-O: absolute symbol or symbol from a section other than __TEXT_EXEC __text, __TEXT __text, __DATA __data, or __DATA __bss.
  • r, R β€” read-only data object.
  • t, T β€” code (text) object.
  • u β€” ELF: GNU unique symbol.
  • U β€” named object is undefined in this file.
  • v β€” ELF: undefined weak object. it is not a link failure if the object is not defined.
  • V β€” ELF: defined weak object symbol. this definition will only be used if no regular definitions exist in a link. if multiple weak definitions and no regular definitions exist, one of the weak definitions will be used.
  • w β€” undefined weak symbol other than an ELF object symbol. it is not a link failure if the symbol is not defined.
  • W β€” defined weak symbol other than an ELF object symbol. this definition will only be used if no regular definitions exist in a link. if multiple weak definitions and no regular definitions exist, one of the weak definitions will be used.
  • - β€” Mach-O: N_STAB symbol.
  • ? β€” something unrecognizable. πŸ’€

because LLVM bitcode files typically contain objects that are not considered to have addresses until they are linked into an executable image or dynamically compiled "just-in-time", llvm-nm does not print an address for any symbol in an LLVM bitcode file β€” even symbols which are defined in the bitcode file. no address, no problem, she's just built different 🫢.


πŸ’… OPTIONS πŸ’…

  • -B β€” use BSD output format. alias for --format=bsd.
  • -X β€” specify the type of XCOFF object file, ELF object file, or IR object file input from command line or from archive files that llvm-nm should examine. the mode must be one of the following:
    • 32 β€” process only 32-bit object files.
    • 64 β€” process only 64-bit object files.
    • 32_64 β€” process both 32-bit and 64-bit object files.
    • any β€” process all the supported object files.

on AIX OS, the default is to process 32-bit object files only and to ignore 64-bit objects. you can change that by setting the OBJECT_MODE environment variable. for example, OBJECT_MODE=64 causes llvm-nm to process 64-bit objects and ignore 32-bit objects. the -X flag overrides the OBJECT_MODE variable, periodt.

on other operating systems, the default is to process all object files: the OBJECT_MODE environment variable is not supported there. πŸ™ˆ

  • --debug-syms, -a β€” show all symbols, even those usually suppressed. no secrets, no hiding.
  • --defined-only, -U β€” print only symbols defined in this file.
  • --demangle, -C β€” demangle symbol names (so your eyes don't bleed).
  • --dynamic, -D β€” display dynamic symbols instead of normal symbols.
  • --export-symbols β€” print sorted symbols with their visibility (if applicable), with duplicates removed.
  • --extern-only, -g β€” print only symbols whose definitions are external; that is, accessible from other files.
  • --format=<format>, -f β€” select an output format; format may be sysv, posix, darwin, bsd or just-symbols. the default is bsd.
  • --help, -h β€” print a summary of command-line options and their meanings.
  • -j β€” print just the symbol names. alias for `--format=just-symbols``.
  • --line-numbers, -l β€” use debugging information to print the filenames and line numbers where symbols are defined. undefined symbols have the location of their first relocation printed instead.
  • -m β€” use Darwin format. alias for --format=darwin.
  • --no-demangle β€” don't demangle symbol names. this is the default.
  • --no-llvm-bc β€” disable the LLVM bitcode reader.
  • --no-sort, -p β€” show symbols in the order encountered.
  • --no-weak, -W β€” don't print weak symbols.
  • --numeric-sort, -n, -v β€” sort symbols by address.
  • --portability, -P β€” use POSIX.2 output format. alias for --format=posix.
  • --print-armap β€” print the archive symbol table, in addition to the symbols.
  • --print-file-name, -A, -o β€” precede each symbol with the file it came from.
  • --print-size, -S β€” show symbol size as well as address (not applicable for Mach-O).
  • --quiet β€” suppress 'no symbols' diagnostic. she's not gonna nag you about it 🫢.
  • --radix=<RADIX>, -t β€” specify the radix of the symbol address(es). values accepted are d (decimal), x (hexadecimal) and o (octal).
  • --reverse-sort, -r β€” sort symbols in reverse order.
  • --size-sort β€” sort symbols by size.
  • --special-syms β€” do not filter special symbols from the output.
  • --undefined-only, -u β€” print only undefined symbols.
  • --version, -V β€” display the version of the llvm-nm executable, then exit. does not stack with other commands.
  • @<FILE> β€” read command-line options from response file <FILE>.

πŸ“ MACH-O SPECIFIC OPTIONS πŸ“

  • --add-dyldinfo β€” add symbols from the dyldinfo, if they are not already in the symbol table. this is the default.
  • --add-inlinedinfo β€” add symbols from the inlined libraries, TBD file inputs only.
  • --arch=<arch1[,arch2,...]> β€” dump the symbols from the specified architecture(s).
  • --dyldinfo-only β€” dump only symbols from the dyldinfo.
  • --no-dyldinfo β€” do not add any symbols from the dyldinfo.
  • -s <segment> <section> β€” dump only symbols from this segment and section name.
  • -x β€” print symbol entry in hex.

🧚 XCOFF SPECIFIC OPTIONS 🧚

  • --no-rsrc β€” exclude resource file symbols (__rsrc) from export symbol list.

πŸ’€ BUGS πŸ’€

  • llvm-nm does not support the full set of arguments that GNU nm does. ngl, she's not GNU and she's not trying to be ✨.

πŸ”₯ EXIT STATUS πŸ”₯

llvm-nm exits with an exit code of zero. iconic. no drama, no tears, just 0 πŸ’–.


🌈 SEE ALSO 🌈

llvm-ar(1), llvm-objdump(1), llvm-readelf(1), llvm-readobj(1) β€” the whole friend group, go say hi.


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/).


2003-2025, LLVM Project


and that's the page bestie!! this was page 20, dated 2025-09-03, from your favs over in the LLVM section of the manual πŸ’…βœ¨ go list some symbols, you ate 🫢
πŸ“¦ where this page comes from