Sign in

nm(1) on Solnix vs Linux and the BSDs

On Solnix, nm is the illumos nm at /usr/bin/nm, which reads ELF objects with single-letter flags that clash with GNU and BSD nm. Its -o means octal, -r prepends the file name, -n sorts by name, -s prints section names and -p gives terse output.

What Solnix runs

A default Solnix system runs the illumos nm at /usr/bin/nm. /usr/xpg4/bin/nm is also shipped with the same synopsis; the documented difference is -u, where /usr/bin/nm prints undefined symbols only and the xpg4 version prints a long listing for each. GNU nm is available from pkgs.solnix.binutils, installed as gnm; its page calls it nm.

Differences

Compared withTopicWhat differs
Linuxgnm is Linux's nmThe binutils gnm page has the same synopsis and options as the Linux binutils nm page: it is the same program. Scripts written for Linux nm should call gnm on Solnix, not /usr/bin/nm.
Source: Solnix gnm(1) from pkgs.solnix.binutils SYNOPSIS, OPTIONS; Linux nm(1) SYNOPSIS, OPTIONS
Linux, FreeBSD, OpenBSD-o meaningSolnix nm -o prints values and sizes in octal, the same as -t o. On Linux and FreeBSD, -o is the same as -A and puts the file name on each line; OpenBSD -o shows the object's name on every line, similar to -A.
Source: illumos nm(1) -o; Linux nm(1) -A, -o; FreeBSD nm(1) --print-file-name, -A, -o; OpenBSD nm(1) -o
Linux, FreeBSD, OpenBSD-r meaningSolnix nm -r prepends the object file or archive name to each output line. FreeBSD and OpenBSD -r reverses the sort order, and the Linux synopsis lists -r as --reverse-sort.
Source: illumos nm(1) -r; FreeBSD nm(1) --reverse-sort, -r; OpenBSD nm(1) -r; Linux nm(1) SYNOPSIS
Linux, FreeBSD, OpenBSD-n sortingSolnix nm -n sorts external symbols by name and -v by value. FreeBSD -n and -v both sort by address, and the Linux synopsis lists -n and -v as --numeric-sort. OpenBSD -n gives numerical order.
Source: illumos nm(1) -n, -v; FreeBSD nm(1) --numeric-sort, -n, -v; Linux nm(1) SYNOPSIS; OpenBSD nm(1) -n
Linux, FreeBSD, OpenBSD-p meaningSolnix nm -p gives terse, easy-to-parse output with a type letter per symbol; its unsorted option is -i. FreeBSD and OpenBSD -p means no sorting, and the Linux synopsis lists -p as --no-sort.
Source: illumos nm(1) -p, -i; FreeBSD nm(1) --no-sort, -p; OpenBSD nm(1) -p; Linux nm(1) SYNOPSIS
Linux, FreeBSD, OpenBSD-s meaningSolnix nm -s prints the section name instead of the section index. OpenBSD -s shows the archive index, the Linux synopsis lists -s as --print-armap, and FreeBSD documents --print-armap with no -s.
Source: illumos nm(1) -s; OpenBSD nm(1) -s; Linux nm(1) SYNOPSIS; FreeBSD nm(1) --print-armap
Linux, FreeBSD-h meaningSolnix nm -h suppresses the output heading. FreeBSD -h prints help, and the Linux synopsis lists -h as --help.
Source: illumos nm(1) -h; FreeBSD nm(1) --help, -h; Linux nm(1) SYNOPSIS
Linux-l meaningSolnix nm -l appends * to the type letter of weak symbols. The Linux synopsis lists -l as --line-numbers.
Source: illumos nm(1) -l; Linux nm(1) SYNOPSIS
Linux, FreeBSD, OpenBSDnumeric radix default and -tSolnix -t takes d, o or x and defaults to decimal. Linux prints values in hexadecimal by default, and FreeBSD's default BSD format prints an 8-digit hex address. OpenBSD's -t applies only to POSIX-format output.
Source: illumos nm(1) -t format; Linux nm(1) DESCRIPTION; FreeBSD nm(1) DESCRIPTION; OpenBSD nm(1) -t
OpenBSD-e meaningSolnix nm -e is deprecated and has no effect. OpenBSD -e outputs extended information: w for weak symbols, f for function-like and o for object-like.
Source: illumos nm(1) -e, NOTES; OpenBSD nm(1) -e
Linux, FreeBSDlong options and extra flagsSolnix nm has no long options and none of -S, -a, -U, -W, -j or -B, which Linux and FreeBSD both document.
Source: illumos nm(1) SYNOPSIS; Linux nm(1) SYNOPSIS; FreeBSD nm(1) OPTIONS
FreeBSDexit statusThe FreeBSD page is llvm-nm, whose EXIT STATUS says it exits with code zero. Solnix nm returns >0 on error, and reports a file with no symbol table without treating it as an error.
Source: FreeBSD nm(1) EXIT STATUS; illumos nm(1) DESCRIPTION, EXIT STATUS

Everyday tasks

TaskSolnixLinuxFreeBSDOpenBSD
list the symbols of an object filenm filenm filellvm-nm filenm file
show the dynamic symbol tablenm -D filenm -D filellvm-nm -D filenm -D file
demangle C++ symbol namesnm -C filenm -C filellvm-nm -C filenm -C file
show only external (global) symbolsnm -g filenm -g filellvm-nm -g filenm -g file
show only undefined symbolsnm -u file—llvm-nm -u filenm -u file
print the file name on every symbol linenm -A filenm -A filellvm-nm -A filenm -A file
sort symbols by address (value)nm -v filenm -n filellvm-nm -n filenm -n file
list symbols in table order, unsortednm -i filenm -p filellvm-nm -p filenm -p file
print symbol values in hexadecimalnm -t x filenm -t x filellvm-nm -t x filenm -P -t x file

Standards

  • POSIX: nm is a POSIX.1-2024 utility.
  • Solnix: The /usr/xpg4/bin/nm ATTRIBUTES table lists Interface Stability: Committed.
  • OpenBSD: The nm utility is part of the IEEE Std 1003.1-2008 (“POSIX.1”) specification; this implementation is largely incompatible with that standard.

Writing portable scripts

  • Avoid -o, -r, -n, -p, -s, -h and -f in portable scripts: each means something different on Solnix nm than on GNU or BSD nm. Use -P with an explicit -t radix, since the default radix differs.
  • Use -g for external symbols and -u for undefined symbols. Their meanings match across the pages, but the Solnix /usr/bin/nm and /usr/xpg4/bin/nm outputs for -u differ.

Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.