NM(1)                      POSIX Programmer's Manual                     NM(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       nm -- write the name list of an object file (DDEEVVEELLOOPPMMEENNTT)

SSYYNNOOPPSSIISS
       nm [[-APv]] [[-g|-u]] [[-t _f_o_r_m_a_t]] _f_i_l_e...
       nm [[-APv]] [[-efox]] [[-g|-u]] [[-t _f_o_r_m_a_t]] _f_i_l_e...

DDEESSCCRRIIPPTTIIOONN
       The _n_m utility shall display symbolic information appearing in the
       object file, executable file, or object-file library named by _f_i_l_e.  If
       no symbolic information is available for a valid input file, the _n_m
       utility shall report that fact, but not consider it an error condition.

       The default base used when numeric values are written is unspecified.
       On XSI-conformant systems, it shall be decimal if the --PP option is not
       specified.

OOPPTTIIOONNSS
       The _n_m utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following options shall be supported:

       --AA        Write the full pathname or library name of an object on each
                 line.

       --ee        Write only external (global) and static symbol information.

       --ff        Produce full output. Write redundant symbols (..tteexxtt, ..ddaattaa,
                 and ..bbssss), normally suppressed.

       --gg        Write only external (global) symbol information.

       --oo        Write numeric values in octal (equivalent to --tt oo).

       --PP        Write information in a portable output format, as specified
                 in the STDOUT section.

       --tt _f_o_r_m_a_t Write each numeric value in the specified format. The format
                 shall be dependent on the single character used as the _f_o_r_m_a_t
                 option-argument:

                 d     decimal (default if --PP is not specified).

                 o     octal.

                 x     hexadecimal (default if --PP is specified).

       --uu        Write only undefined symbols.

       --vv        Sort output by value instead of by symbol name.

       --xx        Write numeric values in hexadecimal (equivalent to --tt xx).

OOPPEERRAANNDDSS
       The following operand shall be supported:

       _f_i_l_e      A pathname of an object file, executable file, or object-file
                 library.

SSTTDDIINN
       See the INPUT FILES section.

IINNPPUUTT FFIILLEESS
       The input file shall be an object file, an object-file library whose
       format is the same as those produced by the _a_r utility for link
       editing, or an executable file. The _n_m utility may accept additional
       implementation-defined object library formats for the input file.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _n_m:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_O_L_L_A_T_E
                 Determine the locale for character collation information for
                 the symbol-name and symbol-value collation sequences.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       If symbolic information is present in the input files, then for each
       file or for each member of an archive, the _n_m utility shall write the
       following information to standard output. By default, the format is
       unspecified, but the output shall be sorted by symbol name according to
       the collation sequence in the current locale.

        *  Library or object name, if --AA is specified

        *  Symbol name

        *  Symbol type, which shall either be one of the following single
           characters or an implementation-defined type represented by a
           single character:

           A     Global absolute symbol.

           a     Local absolute symbol.

           B     Global ``bss'' (that is, uninitialized data space) symbol.

           b     Local bss symbol.

           D     Global data symbol.

           d     Local data symbol.

           T     Global text symbol.

           t     Local text symbol.

           U     Undefined symbol.

        *  Value of the symbol

        *  The size associated with the symbol, if applicable

       This information may be supplemented by additional information specific
       to the implementation.

       If the --PP option is specified, the previous information shall be
       displayed using the following portable format. The three versions
       differ depending on whether --tt dd, --tt oo, or --tt xx was specified,
       respectively:


           "%s%s %s %d %d\n", <_l_i_b_r_a_r_y_/_o_b_j_e_c_t _n_a_m_e>, <_n_a_m_e>, <_t_y_p_e>,
               <_v_a_l_u_e>, <_s_i_z_e>

           "%s%s %s %o %o\n", <_l_i_b_r_a_r_y_/_o_b_j_e_c_t _n_a_m_e>, <_n_a_m_e>, <_t_y_p_e>,
               <_v_a_l_u_e>, <_s_i_z_e>

           "%s%s %s %x %x\n", <_l_i_b_r_a_r_y_/_o_b_j_e_c_t _n_a_m_e>, <_n_a_m_e>, <_t_y_p_e>,
               <_v_a_l_u_e>, <_s_i_z_e>

       where <_l_i_b_r_a_r_y_/_o_b_j_e_c_t _n_a_m_e> shall be formatted as follows:

        *  If --AA is not specified, <_l_i_b_r_a_r_y_/_o_b_j_e_c_t _n_a_m_e> shall be an empty
           string.

        *  If --AA is specified and the corresponding _f_i_l_e operand does not name
           a library:


               "%s: ", <_f_i_l_e>

        *  If --AA is specified and the corresponding _f_i_l_e operand names a
           library. In this case, <_o_b_j_e_c_t _f_i_l_e> shall name the object file in
           the library containing the symbol being described:


               "%s[%s]: ", <_f_i_l_e>, <_o_b_j_e_c_t _f_i_l_e>

       If --AA is not specified, then if more than one _f_i_l_e operand is specified
       or if only one _f_i_l_e operand is specified and it names a library, _n_m
       shall write a line identifying the object containing the following
       symbols before the lines containing those symbols, in the form:

        *  If the corresponding _f_i_l_e operand does not name a library:


               "%s:\n", <_f_i_l_e>

        *  If the corresponding _f_i_l_e operand names a library; in this case,
           <_o_b_j_e_c_t _f_i_l_e> shall be the name of the file in the library
           containing the following symbols:


               "%s[%s]:\n", <_f_i_l_e>, <_o_b_j_e_c_t _f_i_l_e>

       If --PP is specified, but --tt is not, the format shall be as if --tt xx had
       been specified.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Mechanisms for dynamic linking make this utility less meaningful when
       applied to an executable file because a dynamically linked executable
       may omit numerous library routines that would be found in a statically
       linked executable.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       Historical implementations of _n_m have used different bases for numeric
       output and supplied different default types of symbols that were
       reported. The --tt _f_o_r_m_a_t option, similar to that used in _o_d and _s_t_r_i_n_g_s,
       can be used to specify the numeric base; --gg and --uu can be used to
       restrict the amount of output or the types of symbols included in the
       output.

       The compromise of using --tt _f_o_r_m_a_t _v_e_r_s_u_s using --dd, --oo, and other
       similar options was necessary because of differences in the meaning of
       --oo between implementations. The --oo option from BSD has been provided
       here as --AA to avoid confusion with the --oo from System V (which has been
       provided here as --tt and as --oo on XSI-conformant systems).

       The option list was significantly reduced from that provided by
       historical implementations.

       The _n_m description is a subset of both the System V and BSD _n_m
       utilities with no specified default output.

       It was recognized that mechanisms for dynamic linking make this utility
       less meaningful when applied to an executable file (because a
       dynamically linked executable file may omit numerous library routines
       that would be found in a statically linked executable file), but the
       value of _n_m during software development was judged to outweigh other
       limitations.

       The default output format of _n_m is not specified because of differences
       in historical implementations.  The --PP option was added to allow some
       type of portable output format. After a comparison of the different
       formats used in SunOS, BSD, SVR3, and SVR4, it was decided to create
       one that did not match the current format of any of these four systems.
       The format devised is easy to parse by humans, easy to parse in shell
       scripts, and does not need to vary depending on locale (because no
       English descriptions are included).  All of the systems currently have
       the information available to use this format.

       The format given in _n_m STDOUT uses <space> characters between the
       fields, which may be any number of <blank> characters required to align
       the columns. The single-character types were selected to match
       historical practice, and the requirement that implementation additions
       also be single characters made parsing the information easier for shell
       scripts.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _a_r, _c_9_9

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version 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 .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                                NM(1)
