2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH NM 1 "Oct 25, 2017"
14 nm \- print name list of an object file
18 \fB/usr/bin/nm\fR [\fB-ACDhlnPprRsTuVv\fR] [\fB-efox\fR] [\fB-g\fR | \fB-u\fR]
19 [\fB-t\fR \fIformat\fR] \fIfile\fR...
25 The \fBnm\fR utility displays the symbol table of each \fBELF\fR object file
26 that is specified by \fIfile\fR.
29 If no symbolic information is available for a valid input file, the \fBnm\fR
30 utility reports that fact, but not consider it an error condition.
34 The output of \fBnm\fR can be controlled using the following options:
41 Writes the full path name or library name of an object on each line.
50 Demangles C++ symbol names before printing them out.
59 Displays the \fBSHT_DYNSYM\fR symbol information. This is the symbol table used
60 by \fBld.so.1\fR and is present even in stripped dynamic executables. If
61 \fB-D\fR is not specified, the default behavior is to display the
62 \fBSHT_SYMTAB\fR symbol information.
89 Writes only external (global) symbol information.
98 Does not display the output heading data.
107 Displays the \fBSHT_SUNW_LDYNSYM\fR symbol information. This symbol table
108 contains local function symbols. \fBSHT_SUNW_LDYNSM\fR symbol tables are
109 present even in stripped dynamic executables. These symbols augment the global
110 symbols that are found in \fBSHT_DYNSYM\fR symbol table. If \fB-L\fR is not
111 specified, the default behavior is to display the \fBSHT_SYMTAB\fR symbol
121 Distinguishes between \fBWEAK\fR and \fBGLOBAL\fR symbols by appending a * to
122 the key letter for \fBWEAK\fR symbols.
131 Sorts external symbols by name before they are printed.
140 Prints the value and size of a symbol in octal instead of decimal (equivalent
141 to \fB-t\fR \fBo\fR).
150 Produces easy to parse, terse output. Each symbol name is preceded by its value
151 (blanks if undefined) and one of the letters:
167 bss (uninitialized data space) symbol.
212 Thread-Local storage symbol.
242 If the symbol's binding attribute is:
249 The key letter is lower case.
258 The key letter is upper case. If the \fB-l\fR modifier is specified, the upper
259 case key letter is followed by a \fB*\fR
268 The key letter is upper case.
279 Writes information in a portable output format, as specified in \fBStandard
289 Prepends the name of the object file or archive to each output line.
298 Prints the archive name (if present), followed by the object file and symbol
299 name. If the \fB-r\fR option is also specified, this option is ignored.
308 Prints section name instead of section index.
314 \fB\fB-t\fR \fIformat\fR\fR
317 Writes each numeric value in the specified format. The format is dependent on
318 the single character used as the \fIformat\fR option-argument:
325 The offset is written in decimal.
334 The offset is written in octal.
343 The offset is written in hexadecimal (default).
363 Prints long listing for each undefined symbol. See \fBOUTPUT\fR below.
372 Sorts external symbols by value before they are printed.
381 Prints the version of the \fBnm\fR command executing on the standard error
391 Prints the value and size of a symbol in hexadecimal (the default,
392 equivalent to \fB-t\fR \fBx\fR).
397 Options can be used in any order, either singly or in combination, and can
398 appear anywhere in the command line. When conflicting options are specified
399 (such as \fB-v\fR and \fB-n\fR, or \fB-o\fR and \fB-x\fR) the first is taken
400 and the second ignored with a warning message to the user. (See \fB-R\fR for
405 The following operand is supported:
412 A path name of an object file, executable file or object-file library.
418 This section describes the \fBnm\fR utility's output options.
419 .SS "Standard Output"
422 For each symbol, the following information is printed:
429 The index of the symbol. (The index appears in brackets.)
438 The value of the symbol is one of the following:
443 A section offset for defined symbols in a relocatable file.
449 Alignment constraints for symbols whose section index is \fBSHN_COMMON\fR.
455 A virtual address in executable and dynamic library files.
465 The size in bytes of the associated object.
474 A symbol is of one of the following types:
481 No type was specified.
490 A data object such as an array or variable.
499 A function or other executable code.
508 A register symbol (\fBSPARC\fR only).
526 Name of the source file.
535 An uninitialized common block.
544 A variable associated with Thread-Local storage.
555 The symbol's binding attributes.
559 \fB\fBLOCAL symbols\fR\fR
562 Have a scope limited to the object file containing their definition.
568 \fB\fBGLOBAL symbols\fR\fR
571 Are visible to all object files being combined.
577 \fB\fBWEAK symbols\fR\fR
580 Are essentially global symbols with a lower precedence than \fBGLOBAL\fR.
591 A symbol's visibility.
593 The lower bits of the \fBst_other\fR member of the \fBElf32_Sym\fR structure,
594 and the \fBElf64_Sym\fR structure, defined in \fB<sys/elf.h>\fR, are currently
595 used and can be one of:
599 #define STV_DEFAULT 0
600 #define STV_INTERNAL 1
602 #define STV_PROTECTED 3
603 #define STV_EXPORTED 4
604 #define STV_SINGLETON 5
605 #define STV_ELIMINATE 6
618 Except for three special values, this is the section header table index in
619 relation to which the symbol is defined. The following special values exist:
626 Indicates the symbol's value does not change through relocation.
635 Indicates an unallocated block and the value provides alignment constraints.
644 Indicates an undefined symbol.
655 The name of the symbol.
661 \fB\fBObject Name\fR\fR
664 The name of the object or library if \fB-A\fR is specified.
669 If the \fB-P\fR option is specified, the previous information is displayed
670 using the following portable format. The three versions differ depending on
671 whether \fB-t\fR \fBd\fR, \fB-t\fR \fBo\fR, or \fB-t\fR \fBx\fR was specified,
676 \fB"%s%s %s %d %d\n",\fR \fIlibrary/object name\fR, \fIname\fR\fB, type,\fR \fIvalue\fR, \e
677 \fBsize "%s%s %s %o %o\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e
678 \fBtype,\fR \fIvalue\fR \fB, size "%s%s %s %x %x\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e
679 \fBtype,\fR \fIvalue\fR\fB, size\fR
686 where \fIlibrary/object name\fR is formatted as follows:
691 If \fB-A\fR is not specified, \fIlibrary/object name\fR is an empty string.
697 If \fB-A\fR is specified and the corresponding \fIfile\fR operand does not name
702 \fB"%s: ", \fIfile\fR\fR
712 If \fB-A\fR is specified and the corresponding \fIfile\fR operand names a
713 library. In this case, \fIobject file\fR names the object file in the library
714 containing the symbol being described:
718 \fB"%s[%s]: ", \fIfile\fR, \fIobject file\fR\fR
726 If \fB-A\fR is not specified, then if more than one \fIfile\fR operand is
727 specified or if only one \fIfile\fR operand is specified and it names a
728 library, \fBnm\fR writes a line identifying the object containing the following
729 symbols before the lines containing those symbols, in the form:
734 If the corresponding \fIfile\fR operand does not name a library:
738 \fB"%s:\en", \fIfile\fR\fR
748 If the corresponding \fIfile\fR operand names a library; in this case,
749 \fIobject file\fR is the name of the file in the library containing the
754 \fB"%s[%s]:\en", \fIfile\fR, \fIobject file\fR\fR
762 If \fB-P\fR is specified, but \fB-t\fR is not, the format is as if \fB-t\fR
763 \fBx\fR had been specified.
764 .SH ENVIRONMENT VARIABLES
767 See \fBenviron\fR(5) for descriptions of the following environment variables
768 that affect the execution of \fBnm\fR: \fBLANG\fR, \fBLC_ALL\fR,
769 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
773 The following exit values are returned:
780 Successful completion.
795 See \fBattributes\fR(5) for descriptions of the following attributes:
804 ATTRIBUTE TYPE ATTRIBUTE VALUE
806 Interface Stability Committed
812 \fBar\fR(1), \fBas\fR(1), \fBdump\fR(1), \fBld\fR(1), \fBld.so.1\fR(1),
813 \fBar.h\fR(3HEAD), \fBa.out\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
818 The following options are obsolete because of changes to the object file format
819 and might be deleted in a future release.
826 Prints only external and static symbols. The symbol table now contains only
827 static and external symbols. Automatic symbols no longer appear in the symbol
828 table. They do appear in the debugging information produced by \fBcc\fR
829 \fB-g\fR, which can be examined using \fBdump\fR(1).
838 Produces full output. Redundant symbols (such as \fB\&.text\fR, \fB\&.data\fR,
839 and so forth), which existed previously, do not exist and producing full output
840 is identical to the default output.
849 By default, \fBnm\fR prints the entire name of the symbols listed. Since symbol
850 names have been moved to the last column, the problem of overflow is removed
851 and it is no longer necessary to truncate the symbol name.