xref: /openbsd/usr.bin/nm/nm.1 (revision 5af055cd)
1.\"	$OpenBSD: nm.1,v 1.30 2015/09/15 15:44:07 schwarze Exp $
2.\"	$NetBSD: nm.1,v 1.3 1995/08/31 23:41:58 jtc Exp $
3.\"
4.\" Copyright (c) 1980, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)nm.1	8.1 (Berkeley) 6/6/93
32.\"
33.Dd $Mdocdate: September 15 2015 $
34.Dt NM 1
35.Os
36.Sh NAME
37.Nm nm
38.Nd display name list (symbol table)
39.Sh SYNOPSIS
40.Nm nm
41.Op Fl AaCDegnoPprsuw
42.Op Fl t Cm d Ns | Ns Cm o Ns | Ns Cm x
43.Op Ar
44.Sh DESCRIPTION
45The symbol table (name list) of each object in
46.Ar file(s)
47is displayed.
48If a library (archive) is given,
49.Nm
50displays a list for each
51object archive member.
52If
53.Ar file
54is not present,
55.Nm
56searches for the file
57.Pa a.out
58and displays its symbol table if it exists.
59.Pp
60The options are as follows:
61.Bl -tag -width Ds
62.It Fl A
63Display the full path or library name of object on every line.
64.It Fl a
65Display symbol table entries inserted for use by debuggers.
66.It Fl C
67Decode low-level symbol names.
68This involves removing extra underscores and making C++ function names readable.
69.It Fl D
70Display the dynamic symbol table instead of the normal symbol table.
71.It Fl e
72Output extended information, that is `w' for weak symbols, `f' for
73function-like symbols, and `o' for object-like symbols.
74.It Fl g
75Restrict display to external (global) symbols.
76.It Fl n
77Present results in numerical order.
78.It Fl o
79Display the full path or library name of object on every line
80.Pq this is similar to Fl A .
81.It Fl P
82Report information in POSIX format: full path or library name of object if
83either
84.Fl A
85or
86.Fl o
87has been specified; symbol name; symbol type;
88symbol value and size (unless the symbol is undefined).
89The radix of symbol values and sizes defaults to decimal, and may be changed
90with the
91.Fl t
92option.
93.It Fl p
94Do not sort at all.
95.It Fl r
96Reverse order sort.
97.It Fl s
98Show archive index.
99.It Fl t Cm d Ns | Ns Cm o Ns | Ns Cm x
100In POSIX format output, choose the numeric radix as follows:
101.Pp
102.Bl -tag -width 3n -compact -offset indent
103.It Cm d
104Decimal.
105.It Cm o
106Octal.
107.It Cm x
108Hexadecimal.
109.El
110.It Fl u
111Display undefined symbols only.
112.It Fl w
113Warn about non-object archive members.
114Normally,
115.Nm nm
116will silently ignore all archive members which are not
117object files.
118.El
119.Pp
120Each symbol name is preceded by its value (a blank field if the symbol
121is undefined) and one of the following letters:
122.Pp
123.Bl -tag -width Ds -compact -offset indent
124.It Fl
125debugger symbol table entries (see the
126.Fl a
127option)
128.It Li A
129absolute
130.It Li B
131bss or tbss segment symbol
132.It Li C
133common symbol
134.It Li D
135data or tdata segment symbol
136.It Li F
137file name
138.It Li R
139read-only data segment symbol
140.It Li T
141text segment symbol
142.It Li U
143undefined
144.It Li W
145weak symbol
146.El
147.Pp
148If the symbol is local (non-external), the type letter is in lower case.
149The output is sorted alphabetically.
150.Sh SEE ALSO
151.Xr ar 1 ,
152.Xr size 1 ,
153.Xr ar 5 ,
154.Xr elf 5
155.Sh STANDARDS
156The
157.Nm
158utility is part of the
159.St -p1003.1-2008
160specification;
161this implementation is largely incompatible with that standard.
162.Sh HISTORY
163An
164.Nm nm
165command appeared in
166.At v6 .
167