2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 .TH NM 1 "Oct 25, 2017"
49 nm \- print name list of an object file
53 \fB/usr/bin/nm\fR [\fB-ACDhlnPprRsTuVv\fR] [\fB-efox\fR] [\fB-g\fR | \fB-u\fR]
54 [\fB-t\fR \fIformat\fR] \fIfile\fR...
60 The \fBnm\fR utility displays the symbol table of each \fBELF\fR object file
61 that is specified by \fIfile\fR.
64 If no symbolic information is available for a valid input file, the \fBnm\fR
65 utility reports that fact, but not consider it an error condition.
69 The output of \fBnm\fR can be controlled using the following options:
76 Writes the full path name or library name of an object on each line.
85 Demangles C++ symbol names before printing them out.
94 Displays the \fBSHT_DYNSYM\fR symbol information. This is the symbol table used
95 by \fBld.so.1\fR and is present even in stripped dynamic executables. If
96 \fB-D\fR is not specified, the default behavior is to display the
97 \fBSHT_SYMTAB\fR symbol information.
124 Writes only external (global) symbol information.
133 Does not display the output heading data.
142 Displays the \fBSHT_SUNW_LDYNSYM\fR symbol information. This symbol table
143 contains local function symbols. \fBSHT_SUNW_LDYNSM\fR symbol tables are
144 present even in stripped dynamic executables. These symbols augment the global
145 symbols that are found in \fBSHT_DYNSYM\fR symbol table. If \fB-L\fR is not
146 specified, the default behavior is to display the \fBSHT_SYMTAB\fR symbol
156 Distinguishes between \fBWEAK\fR and \fBGLOBAL\fR symbols by appending a * to
157 the key letter for \fBWEAK\fR symbols.
166 Sorts external symbols by name before they are printed.
175 Prints the value and size of a symbol in octal instead of decimal (equivalent
176 to \fB-t\fR \fBo\fR).
185 Produces easy to parse, terse output. Each symbol name is preceded by its value
186 (blanks if undefined) and one of the letters:
202 bss (uninitialized data space) symbol.
247 Thread-Local storage symbol.
277 If the symbol's binding attribute is:
284 The key letter is lower case.
293 The key letter is upper case. If the \fB-l\fR modifier is specified, the upper
294 case key letter is followed by a \fB*\fR
303 The key letter is upper case.
314 Writes information in a portable output format, as specified in \fBStandard
324 Prepends the name of the object file or archive to each output line.
333 Prints the archive name (if present), followed by the object file and symbol
334 name. If the \fB-r\fR option is also specified, this option is ignored.
343 Prints section name instead of section index.
349 \fB\fB-t\fR \fIformat\fR\fR
352 Writes each numeric value in the specified format. The format is dependent on
353 the single character used as the \fIformat\fR option-argument:
360 The offset is written in decimal.
369 The offset is written in octal.
378 The offset is written in hexadecimal (default).
398 Prints long listing for each undefined symbol. See \fBOUTPUT\fR below.
407 Sorts external symbols by value before they are printed.
416 Prints the version of the \fBnm\fR command executing on the standard error
426 Prints the value and size of a symbol in hexadecimal (the default,
427 equivalent to \fB-t\fR \fBx\fR).
432 Options can be used in any order, either singly or in combination, and can
433 appear anywhere in the command line. When conflicting options are specified
434 (such as \fB-v\fR and \fB-n\fR, or \fB-o\fR and \fB-x\fR) the first is taken
435 and the second ignored with a warning message to the user. (See \fB-R\fR for
440 The following operand is supported:
447 A path name of an object file, executable file or object-file library.
453 This section describes the \fBnm\fR utility's output options.
454 .SS "Standard Output"
457 For each symbol, the following information is printed:
464 The index of the symbol. (The index appears in brackets.)
473 The value of the symbol is one of the following:
478 A section offset for defined symbols in a relocatable file.
484 Alignment constraints for symbols whose section index is \fBSHN_COMMON\fR.
490 A virtual address in executable and dynamic library files.
500 The size in bytes of the associated object.
509 A symbol is of one of the following types:
516 No type was specified.
525 A data object such as an array or variable.
534 A function or other executable code.
543 A register symbol (\fBSPARC\fR only).
561 Name of the source file.
570 An uninitialized common block.
579 A variable associated with Thread-Local storage.
590 The symbol's binding attributes.
594 \fB\fBLOCAL symbols\fR\fR
597 Have a scope limited to the object file containing their definition.
603 \fB\fBGLOBAL symbols\fR\fR
606 Are visible to all object files being combined.
612 \fB\fBWEAK symbols\fR\fR
615 Are essentially global symbols with a lower precedence than \fBGLOBAL\fR.
626 A symbol's visibility.
628 The lower bits of the \fBst_other\fR member of the \fBElf32_Sym\fR structure,
629 and the \fBElf64_Sym\fR structure, defined in \fB<sys/elf.h>\fR, are currently
630 used and can be one of:
634 #define STV_DEFAULT 0
635 #define STV_INTERNAL 1
637 #define STV_PROTECTED 3
638 #define STV_EXPORTED 4
639 #define STV_SINGLETON 5
640 #define STV_ELIMINATE 6
653 Except for three special values, this is the section header table index in
654 relation to which the symbol is defined. The following special values exist:
661 Indicates the symbol's value does not change through relocation.
670 Indicates an unallocated block and the value provides alignment constraints.
679 Indicates an undefined symbol.
690 The name of the symbol.
696 \fB\fBObject Name\fR\fR
699 The name of the object or library if \fB-A\fR is specified.
704 If the \fB-P\fR option is specified, the previous information is displayed
705 using the following portable format. The three versions differ depending on
706 whether \fB-t\fR \fBd\fR, \fB-t\fR \fBo\fR, or \fB-t\fR \fBx\fR was specified,
711 \fB"%s%s %s %d %d\en",\fR \fIlibrary/object name\fR, \fIname\fR\fB, type,\fR \fIvalue\fR, \e
712 \fBsize "%s%s %s %o %o\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e
713 \fBtype,\fR \fIvalue\fR \fB, size "%s%s %s %x %x\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e
714 \fBtype,\fR \fIvalue\fR\fB, size\fR
721 where \fIlibrary/object name\fR is formatted as follows:
726 If \fB-A\fR is not specified, \fIlibrary/object name\fR is an empty string.
732 If \fB-A\fR is specified and the corresponding \fIfile\fR operand does not name
737 \fB"%s: ", \fIfile\fR\fR
747 If \fB-A\fR is specified and the corresponding \fIfile\fR operand names a
748 library. In this case, \fIobject file\fR names the object file in the library
749 containing the symbol being described:
753 \fB"%s[%s]: ", \fIfile\fR, \fIobject file\fR\fR
761 If \fB-A\fR is not specified, then if more than one \fIfile\fR operand is
762 specified or if only one \fIfile\fR operand is specified and it names a
763 library, \fBnm\fR writes a line identifying the object containing the following
764 symbols before the lines containing those symbols, in the form:
769 If the corresponding \fIfile\fR operand does not name a library:
773 \fB"%s:\en", \fIfile\fR\fR
783 If the corresponding \fIfile\fR operand names a library; in this case,
784 \fIobject file\fR is the name of the file in the library containing the
789 \fB"%s[%s]:\en", \fIfile\fR, \fIobject file\fR\fR
797 If \fB-P\fR is specified, but \fB-t\fR is not, the format is as if \fB-t\fR
798 \fBx\fR had been specified.
799 .SH ENVIRONMENT VARIABLES
802 See \fBenviron\fR(5) for descriptions of the following environment variables
803 that affect the execution of \fBnm\fR: \fBLANG\fR, \fBLC_ALL\fR,
804 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
808 The following exit values are returned:
815 Successful completion.
830 See \fBattributes\fR(5) for descriptions of the following attributes:
839 ATTRIBUTE TYPE ATTRIBUTE VALUE
841 Interface Stability Committed
847 \fBar\fR(1), \fBas\fR(1), \fBdump\fR(1), \fBld\fR(1), \fBld.so.1\fR(1),
848 \fBar.h\fR(3HEAD), \fBa.out\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
853 The following options are obsolete because of changes to the object file format
854 and might be deleted in a future release.
861 Prints only external and static symbols. The symbol table now contains only
862 static and external symbols. Automatic symbols no longer appear in the symbol
863 table. They do appear in the debugging information produced by \fBcc\fR
864 \fB-g\fR, which can be examined using \fBdump\fR(1).
873 Produces full output. Redundant symbols (such as \fB\&.text\fR, \fB\&.data\fR,
874 and so forth), which existed previously, do not exist and producing full output
875 is identical to the default output.
884 By default, \fBnm\fR prints the entire name of the symbols listed. Since symbol
885 names have been moved to the last column, the problem of overflow is removed
886 and it is no longer necessary to truncate the symbol name.