1.\" Copyright (c) 2007 Hyogeol Lee <hyogeollee@gmail.com> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer 9.\" in this position and unchanged. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" 25.\" $Id: nm.1 2377 2012-01-03 07:10:59Z jkoshy $ 26.\" 27.Dd January 3, 2012 28.Os 29.Dt NM 1 30.Sh NAME 31.Nm nm 32.Nd display symbolic information in object files 33.Sh SYNOPSIS 34.Nm 35.Op Fl -debug-syms 36.Op Fl -defined-only 37.Op Fl -demangle Ns Op = Ns style 38.Op Fl -dynamic 39.Op Fl -help 40.Op Fl -line-numbers 41.Op Fl -no-demangle 42.Op Fl -no-sort 43.Op Fl -numeric-sort 44.Op Fl -print-armap 45.Op Fl -print-file-name 46.Op Fl -print-size 47.Op Fl -radix= Ns Ar format 48.Op Fl -reverse-sort 49.Op Fl -size-sort 50.Op Fl -undefined-only 51.Op Fl -version 52.Op Fl A 53.Op Fl B 54.Op Fl C Op Ar style 55.Op Fl D 56.Op Fl P 57.Op Fl V 58.Op Fl a 59.Op Fl e 60.Op Fl g 61.Op Fl h 62.Op Fl l 63.Op Fl n 64.Op Fl o 65.Op Fl p 66.Op Fl r 67.Op Fl S 68.Op Fl s 69.Op Fl t Ar format 70.Op Fl u 71.Op Fl x 72.Ar 73.Sh DESCRIPTION 74The 75.Nm 76utility displays symbolic information in the object files, 77executables, and object library files named by its arguments. 78Lack of symbolic information in an otherwise valid input 79file, is not considered to be an error. 80If no files are specified on the command line, 81.Nm 82will attempt to read 83.Pa a.out . 84.Pp 85The 86.Nm 87utility recognizes the following options: 88.Bl -tag -width ".Fl d Ar argument" 89.It Fl -debug-syms 90Display all symbols, including debugger-only symbols. 91.It Fl -defined-only 92Display only defined symbols. 93.It Fl -demangle Ns Op = Ns Ar style 94Decode (demangle) low-level symbol names into human-readable names. 95Supported values for argument 96.Ar style 97are 98.Sq auto , 99.Sq gnu-v2 , 100.Sq gnu-v3 101and 102.Sq arm. 103If argument 104.Ar style 105is not specified, it is taken to be 106.Sq auto . 107.It Fl -dynamic 108Only display dynamic symbols. 109This option is only meaningful for shared libraries. 110.It Fl -help 111Display a help message and exit. 112.It Fl -format Ns = Ns Ar format 113Display output in the format specified by argument 114.Ar format . 115Supported values for the format argument are 116.Sq bsd , 117.Sq sysv , 118and 119.Sq posix . 120The default output format is 121.Sq bsd . 122.It Fl -line-numbers 123Display the filename and line number associated a symbol using 124any debugging information present in the input file. 125For defined symbols, look up the line number associated with 126the address of the symbol. 127For undefined symbols, look up the line number associated with 128a relocation entry that refers to the symbol. 129If line number information can be determined, it is displayed after 130other symbol information. 131.It Fl -no-demangle 132Do not demangle symbol names (default). 133.It Fl -no-sort 134Do not sort symbols. 135.It Fl -numeric-sort 136Sort symbols numerically by address instead of alphabetically by name. 137.It Fl -print-armap 138For 139.Xr ar 1 140archives, include the index of the archive's members. 141.It Fl -print-file-name 142Write the full pathname or library name of an object on each line, 143before the rest of the information for a symbol. 144If this option is not specified, 145.Nm 146will only identify an input file once, before its symbols are 147listed. 148.It Fl -print-size 149Print the size of each symbol instead of its value. 150.It Fl -radix Ns = Ns Ar radix 151Print numeric values using the specified radix. 152Supported values for argument 153.Ar radix 154are 155.Sq d 156for decimal, 157.Sq o 158for octal, and 159.Sq x 160for hexadecimal. 161.It Fl -reverse-sort 162Reverse the order of the sort. 163.It Fl -size-sort 164Sort symbols by size instead of alphabetically by name. 165.It Fl -undefined-only 166Display only undefined symbols. 167.It Fl -version 168Display the version identifier for 169.Nm 170and exit. 171.It Fl A 172Equivalent to specifying option 173.Fl -print-file-name . 174.It Fl B 175Equivalent to specifying option 176.Fl -format= Ns Ar bsd . 177.It Fl C Op Ar style 178Equivalent to specifying option 179.Fl -demangle Ns Op = Ns Ar style . 180.It Fl D 181Equivalent to specifying option 182.Fl -dynamic . 183.It Fl F Ar format 184Equivalent to specifying option 185.Fl -format Ns = Ns Ar format . 186.It Fl P 187Equivalent to specifying option 188.Fl -format Ns = Ns Ar posix . 189.It Fl S 190Equivalent to specifying option 191.Fl -print-size . 192.It Fl V 193Equivalent to specifying option 194.Fl -version . 195.It Fl a 196Equivalent to specifying option 197.Fl -debug-syms . 198.It Fl e 199Only display information for global and static symbols. 200.It Fl f 201Produce full output (default). 202.It Fl g 203Only display information about global (external) symbols. 204.It Fl h 205Equivalent to specifying option 206.Fl -help . 207.It Fl l 208Equivalent to specifying option 209.Fl -line-numbers . 210.It Fl n 211Equivalent to specifying option 212.Fl -numeric-sort . 213.It Fl o 214If POSIX output was specified using the 215.Fl F Ar posix 216or 217.Fl P 218options, this option is equivalent to specifying 219.Fl -radix Ns = Ns Sq Ar o . 220If POSIX output was not specified, this option 221acts as a synonym for the 222.Fl -print-file-name 223option. 224.It Fl p 225Equivalent to specifying option 226.Fl -no-sort . 227.It Fl v 228Equivalent to option 229.Fl n . 230.It Fl r 231Equivalent to specifying option 232.Fl -reverse-sort 233.It Fl s 234Equivalent to specifying option 235.Fl -print-armap . 236.It Fl t Ar radix 237Equivalent to specifying option 238.Fl -radix= Ns Ar radix . 239.It Fl u 240Equivalent to specifying option 241.Fl -undefined-only . 242.It Fl x 243Write numeric values in hexadecimal (equivalent to -t x). 244.El 245.Sh OUTPUT FORMAT 246.Pp 247The 248.Nm 249utility can present its information in a number of formats, numeric 250radices and sort orders. 251By default 252.Nm 253uses BSD style output, a hexadecimal radix, without output sorted 254alphabetically by name and without demangling of names. 255.Pp 256For each symbol listed, 257.Nm 258presents the following information: 259.Bl -bullet -compact 260.It 261The library or object name, if options 262.Fl A 263or 264.Fl -print-file-name 265were specified. 266.It 267The symbol name. 268.It 269The type of the symbol denoted by a single character as below: 270.Bl -tag -compact -width indent 271.It A 272A global, absolute symbol. 273.It B 274A global 275.Dq bss 276(uninitialized data) symbol. 277.It C 278A 279.Dq common 280symbol, representing uninitialized data. 281.It D 282A global symbol naming initialized data. 283.It N 284A debugger symbol. 285.It R 286A read-only data symbol. 287.It T 288A global text symbol. 289.It U 290An undefined symbol. 291.It V 292A weak object. 293.It W 294A weak reference. 295.It a 296A local absolute symbol. 297.It b 298A local 299.Dq bss 300(uninitialized data) symbol. 301.It d 302A local data symbol. 303.It t 304A local text symbol. 305.It v 306A weak object that is undefined. 307.It w 308A weak symbol that is undefined. 309.It ? 310None of the above. 311.El 312.It 313The value of the symbol. 314.It 315The size of the symbol if applicable. 316.It 317Line number information, if available and if options 318.Fl l 319or 320.Fl -line-numbers 321were specified. 322.El 323.Sh EXIT STATUS 324.Ex -std 325.Sh SEE ALSO 326.Xr ar 1 , 327.Xr objdump 1 , 328.Xr ranlib 1 , 329.Xr elf 3 330.Sh AUTHORS 331The 332.Nm 333utility and this manual page were written by 334.An Hyogeol Lee Aq hyogeollee@gmail.com . 335