1 '\" te 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 "Sep 10, 2013" 13 .SH NAME 14 nm \- print name list of an object file 15 .SH SYNOPSIS 16 .LP 17 .nf 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... 20 .fi 21 22 .LP 23 .nf 24 \fB/usr/xpg4/bin/nm\fR [\fB-ACDhlnPprRsTuVv\fR] [\fB-efox\fR] [\fB-g\fR | \fB-u\fR] 25 [\fB-t\fR \fIformat\fR] \fIfile\fR... 26 .fi 27 28 .SH DESCRIPTION 29 .sp 30 .LP 31 The \fBnm\fR utility displays the symbol table of each \fBELF\fR object file 32 that is specified by \fIfile\fR. 33 .sp 34 .LP 35 If no symbolic information is available for a valid input file, the \fBnm\fR 36 utility reports that fact, but not consider it an error condition. 37 .SH OPTIONS 38 .sp 39 .LP 40 The output of \fBnm\fR can be controlled using the following options: 41 .sp 42 .ne 2 43 .na 44 \fB\fB-A\fR\fR 45 .ad 46 .RS 13n 47 Writes the full path name or library name of an object on each line. 48 .RE 49 50 .sp 51 .ne 2 52 .na 53 \fB\fB-C\fR\fR 54 .ad 55 .RS 13n 56 Demangles C++ symbol names before printing them out. 57 .RE 58 59 .sp 60 .ne 2 61 .na 62 \fB\fB-D\fR\fR 63 .ad 64 .RS 13n 65 Displays the \fBSHT_DYNSYM\fR symbol information. This is the symbol table used 66 by \fBld.so.1\fR and is present even in stripped dynamic executables. If 67 \fB-D\fR is not specified, the default behavior is to display the 68 \fBSHT_SYMTAB\fR symbol information. 69 .RE 70 71 .sp 72 .ne 2 73 .na 74 \fB\fB-e\fR\fR 75 .ad 76 .RS 13n 77 See NOTES below. 78 .RE 79 80 .sp 81 .ne 2 82 .na 83 \fB\fB-f\fR\fR 84 .ad 85 .RS 13n 86 See NOTES below. 87 .RE 88 89 .sp 90 .ne 2 91 .na 92 \fB\fB-g\fR\fR 93 .ad 94 .RS 13n 95 Writes only external (global) symbol information. 96 .RE 97 98 .sp 99 .ne 2 100 .na 101 \fB\fB-h\fR\fR 102 .ad 103 .RS 13n 104 Does not display the output heading data. 105 .RE 106 107 .sp 108 .ne 2 109 .na 110 \fB\fB-L\fR\fR 111 .ad 112 .RS 13n 113 Displays the \fBSHT_SUNW_LDYNSYM\fR symbol information. This symbol table 114 contains local function symbols. \fBSHT_SUNW_LDYNSM\fR symbol tables are 115 present even in stripped dynamic executables. These symbols augment the global 116 symbols that are found in \fBSHT_DYNSYM\fR symbol table. If \fB-L\fR is not 117 specified, the default behavior is to display the \fBSHT_SYMTAB\fR symbol 118 information. 119 .RE 120 121 .sp 122 .ne 2 123 .na 124 \fB\fB-l\fR\fR 125 .ad 126 .RS 13n 127 Distinguishes between \fBWEAK\fR and \fBGLOBAL\fR symbols by appending a * to 128 the key letter for \fBWEAK\fR symbols. 129 .RE 130 131 .sp 132 .ne 2 133 .na 134 \fB\fB-n\fR\fR 135 .ad 136 .RS 13n 137 Sorts external symbols by name before they are printed. 138 .RE 139 140 .sp 141 .ne 2 142 .na 143 \fB\fB-o\fR\fR 144 .ad 145 .RS 13n 146 Prints the value and size of a symbol in octal instead of decimal (equivalent 147 to \fB-t\fR \fBo\fR). 148 .RE 149 150 .sp 151 .ne 2 152 .na 153 \fB\fB-p\fR\fR 154 .ad 155 .RS 13n 156 Produces easy to parse, terse output. Each symbol name is preceded by its value 157 (blanks if undefined) and one of the letters: 158 .sp 159 .ne 2 160 .na 161 \fB\fBA\fR\fR 162 .ad 163 .RS 5n 164 Absolute symbol. 165 .RE 166 167 .sp 168 .ne 2 169 .na 170 \fB\fBB\fR\fR 171 .ad 172 .RS 5n 173 bss (uninitialized data space) symbol. 174 .RE 175 176 .sp 177 .ne 2 178 .na 179 \fB\fBC\fR\fR 180 .ad 181 .RS 5n 182 COMMON symbol. 183 .RE 184 185 .sp 186 .ne 2 187 .na 188 \fB\fBD\fR\fR 189 .ad 190 .RS 5n 191 Data object symbol. 192 .RE 193 194 .sp 195 .ne 2 196 .na 197 \fB\fBF\fR\fR 198 .ad 199 .RS 5n 200 File symbol. 201 .RE 202 203 .sp 204 .ne 2 205 .na 206 \fB\fBN\fR\fR 207 .ad 208 .RS 5n 209 Symbol has no type. 210 .RE 211 212 .sp 213 .ne 2 214 .na 215 \fB\fBL\fR\fR 216 .ad 217 .RS 5n 218 Thread-Local storage symbol. 219 .RE 220 221 .sp 222 .ne 2 223 .na 224 \fB\fBS\fR\fR 225 .ad 226 .RS 5n 227 Section symbol. 228 .RE 229 230 .sp 231 .ne 2 232 .na 233 \fB\fBT\fR\fR 234 .ad 235 .RS 5n 236 Text symbol. 237 .RE 238 239 .sp 240 .ne 2 241 .na 242 \fB\fBU\fR\fR 243 .ad 244 .RS 5n 245 Undefined. 246 .RE 247 248 If the symbol's binding attribute is: 249 .sp 250 .ne 2 251 .na 252 \fB\fBLOCAL\fR\fR 253 .ad 254 .RS 10n 255 The key letter is lower case. 256 .RE 257 258 .sp 259 .ne 2 260 .na 261 \fB\fBWEAK\fR\fR 262 .ad 263 .RS 10n 264 The key letter is upper case. If the \fB-l\fR modifier is specified, the upper 265 case key letter is followed by a \fB*\fR 266 .RE 267 268 .sp 269 .ne 2 270 .na 271 \fB\fBGLOBAL\fR\fR 272 .ad 273 .RS 10n 274 The key letter is upper case. 275 .RE 276 277 .RE 278 279 .sp 280 .ne 2 281 .na 282 \fB\fB-P\fR\fR 283 .ad 284 .RS 13n 285 Writes information in a portable output format, as specified in \fBStandard 286 Output\fR. 287 .RE 288 289 .sp 290 .ne 2 291 .na 292 \fB\fB-r\fR\fR 293 .ad 294 .RS 13n 295 Prepends the name of the object file or archive to each output line. 296 .RE 297 298 .sp 299 .ne 2 300 .na 301 \fB\fB-R\fR\fR 302 .ad 303 .RS 13n 304 Prints the archive name (if present), followed by the object file and symbol 305 name. If the \fB-r\fR option is also specified, this option is ignored. 306 .RE 307 308 .sp 309 .ne 2 310 .na 311 \fB\fB-s\fR\fR 312 .ad 313 .RS 13n 314 Prints section name instead of section index. 315 .RE 316 317 .sp 318 .ne 2 319 .na 320 \fB\fB-t\fR \fIformat\fR\fR 321 .ad 322 .RS 13n 323 Writes each numeric value in the specified format. The format is dependent on 324 the single character used as the \fIformat\fR option-argument: 325 .sp 326 .ne 2 327 .na 328 \fB\fBd\fR\fR 329 .ad 330 .RS 5n 331 The offset is written in decimal (default). 332 .RE 333 334 .sp 335 .ne 2 336 .na 337 \fB\fBo\fR\fR 338 .ad 339 .RS 5n 340 The offset is written in octal. 341 .RE 342 343 .sp 344 .ne 2 345 .na 346 \fB\fBx\fR\fR 347 .ad 348 .RS 5n 349 The offset is written in hexadecimal. 350 .RE 351 352 .RE 353 354 .sp 355 .ne 2 356 .na 357 \fB\fB-T\fR\fR 358 .ad 359 .RS 13n 360 See \fBNOTES\fR. 361 .RE 362 363 .SS "/usr/bin/nm" 364 .sp 365 .ne 2 366 .na 367 \fB\fB-u\fR\fR 368 .ad 369 .RS 6n 370 Prints undefined symbols only. 371 .RE 372 373 .SS "/usr/xpg4/bin/nm" 374 .sp 375 .ne 2 376 .na 377 \fB\fB-u\fR\fR 378 .ad 379 .RS 6n 380 Prints long listing for each undefined symbol. See \fBOUTPUT\fR below. 381 .RE 382 383 .sp 384 .ne 2 385 .na 386 \fB\fB-v\fR\fR 387 .ad 388 .RS 6n 389 Sorts external symbols by value before they are printed. 390 .RE 391 392 .sp 393 .ne 2 394 .na 395 \fB\fB-V\fR\fR 396 .ad 397 .RS 6n 398 Prints the version of the \fBnm\fR command executing on the standard error 399 output. 400 .RE 401 402 .sp 403 .ne 2 404 .na 405 \fB\fB-x\fR\fR 406 .ad 407 .RS 6n 408 Prints the value and size of a symbol in hexadecimal instead of decimal 409 (equivalent to \fB-t\fR \fBx\fR). 410 .RE 411 412 .sp 413 .LP 414 Options can be used in any order, either singly or in combination, and can 415 appear anywhere in the command line. When conflicting options are specified 416 (such as \fB-v\fR and \fB-n\fR, or \fB-o\fR and \fB-x\fR) the first is taken 417 and the second ignored with a warning message to the user. (See \fB-R\fR for 418 exception.) 419 .SH OPERANDS 420 .sp 421 .LP 422 The following operand is supported: 423 .sp 424 .ne 2 425 .na 426 \fB\fIfile\fR\fR 427 .ad 428 .RS 8n 429 A path name of an object file, executable file or object-file library. 430 .RE 431 432 .SH OUTPUT 433 .sp 434 .LP 435 This section describes the \fBnm\fR utility's output options. 436 .SS "Standard Output" 437 .sp 438 .LP 439 For each symbol, the following information is printed: 440 .sp 441 .ne 2 442 .na 443 \fB\fBIndex\fR\fR 444 .ad 445 .RS 15n 446 The index of the symbol. (The index appears in brackets.) 447 .RE 448 449 .sp 450 .ne 2 451 .na 452 \fB\fBValue\fR\fR 453 .ad 454 .RS 15n 455 The value of the symbol is one of the following: 456 .RS +4 457 .TP 458 .ie t \(bu 459 .el o 460 A section offset for defined symbols in a relocatable file. 461 .RE 462 .RS +4 463 .TP 464 .ie t \(bu 465 .el o 466 Alignment constraints for symbols whose section index is \fBSHN_COMMON\fR. 467 .RE 468 .RS +4 469 .TP 470 .ie t \(bu 471 .el o 472 A virtual address in executable and dynamic library files. 473 .RE 474 .RE 475 476 .sp 477 .ne 2 478 .na 479 \fB\fBSize\fR\fR 480 .ad 481 .RS 15n 482 The size in bytes of the associated object. 483 .RE 484 485 .sp 486 .ne 2 487 .na 488 \fB\fBType\fR\fR 489 .ad 490 .RS 15n 491 A symbol is of one of the following types: 492 .sp 493 .ne 2 494 .na 495 \fB\fBNOTYPE\fR\fR 496 .ad 497 .RS 11n 498 No type was specified. 499 .RE 500 501 .sp 502 .ne 2 503 .na 504 \fB\fBOBJECT\fR\fR 505 .ad 506 .RS 11n 507 A data object such as an array or variable. 508 .RE 509 510 .sp 511 .ne 2 512 .na 513 \fB\fBFUNC\fR\fR 514 .ad 515 .RS 11n 516 A function or other executable code. 517 .RE 518 519 .sp 520 .ne 2 521 .na 522 \fB\fBREGI\fR\fR 523 .ad 524 .RS 11n 525 A register symbol (\fBSPARC\fR only). 526 .RE 527 528 .sp 529 .ne 2 530 .na 531 \fB\fBSECTION\fR\fR 532 .ad 533 .RS 11n 534 A section symbol. 535 .RE 536 537 .sp 538 .ne 2 539 .na 540 \fB\fBFILE\fR\fR 541 .ad 542 .RS 11n 543 Name of the source file. 544 .RE 545 546 .sp 547 .ne 2 548 .na 549 \fB\fBCOMMON\fR\fR 550 .ad 551 .RS 11n 552 An uninitialized common block. 553 .RE 554 555 .sp 556 .ne 2 557 .na 558 \fB\fBTLS\fR\fR 559 .ad 560 .RS 11n 561 A variable associated with Thread-Local storage. 562 .RE 563 564 .RE 565 566 .sp 567 .ne 2 568 .na 569 \fB\fBBind\fR\fR 570 .ad 571 .RS 15n 572 The symbol's binding attributes. 573 .sp 574 .ne 2 575 .na 576 \fB\fBLOCAL symbols\fR\fR 577 .ad 578 .RS 18n 579 Have a scope limited to the object file containing their definition. 580 .RE 581 582 .sp 583 .ne 2 584 .na 585 \fB\fBGLOBAL symbols\fR\fR 586 .ad 587 .RS 18n 588 Are visible to all object files being combined. 589 .RE 590 591 .sp 592 .ne 2 593 .na 594 \fB\fBWEAK symbols\fR\fR 595 .ad 596 .RS 18n 597 Are essentially global symbols with a lower precedence than \fBGLOBAL\fR. 598 .RE 599 600 .RE 601 602 .sp 603 .ne 2 604 .na 605 \fB\fBOther\fR\fR 606 .ad 607 .RS 15n 608 A symbol's visibility. 609 .sp 610 The lower bits of the \fBst_other\fR member of the \fBElf32_Sym\fR structure, 611 and the \fBElf64_Sym\fR structure, defined in \fB<sys/elf.h>\fR, are currently 612 used and can be one of: 613 .sp 614 .in +2 615 .nf 616 #define STV_DEFAULT 0 617 #define STV_INTERNAL 1 618 #define STV_HIDDEN 2 619 #define STV_PROTECTED 3 620 #define STV_EXPORTED 4 621 #define STV_SINGLETON 5 622 #define STV_ELIMINATE 6 623 .fi 624 .in -2 625 .sp 626 627 .RE 628 629 .sp 630 .ne 2 631 .na 632 \fB\fBShndx\fR\fR 633 .ad 634 .RS 15n 635 Except for three special values, this is the section header table index in 636 relation to which the symbol is defined. The following special values exist: 637 .sp 638 .ne 2 639 .na 640 \fB\fBABS\fR\fR 641 .ad 642 .RS 10n 643 Indicates the symbol's value does not change through relocation. 644 .RE 645 646 .sp 647 .ne 2 648 .na 649 \fB\fBCOMMON\fR\fR 650 .ad 651 .RS 10n 652 Indicates an unallocated block and the value provides alignment constraints. 653 .RE 654 655 .sp 656 .ne 2 657 .na 658 \fB\fBUNDEF\fR\fR 659 .ad 660 .RS 10n 661 Indicates an undefined symbol. 662 .RE 663 664 .RE 665 666 .sp 667 .ne 2 668 .na 669 \fB\fBName\fR\fR 670 .ad 671 .RS 15n 672 The name of the symbol. 673 .RE 674 675 .sp 676 .ne 2 677 .na 678 \fB\fBObject Name\fR\fR 679 .ad 680 .RS 15n 681 The name of the object or library if \fB-A\fR is specified. 682 .RE 683 684 .sp 685 .LP 686 If the \fB-P\fR option is specified, the previous information is displayed 687 using the following portable format. The three versions differ depending on 688 whether \fB-t\fR \fBd\fR, \fB-t\fR \fBo\fR, or \fB-t\fR \fBx\fR was specified, 689 respectively: 690 .sp 691 .in +2 692 .nf 693 \fB"%s%s %s %d %d\n",\fR \fIlibrary/object name\fR, \fIname\fR\fB, type,\fR \fIvalue\fR, \e 694 \fBsize "%s%s %s %o %o\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e 695 \fBtype,\fR \fIvalue\fR \fB, size "%s%s %s %x %x\en",\fR \fIlibrary/object name\fR, \fIname\fR, \e 696 \fBtype,\fR \fIvalue\fR\fB, size\fR 697 .fi 698 .in -2 699 .sp 700 701 .sp 702 .LP 703 where \fIlibrary/object name\fR is formatted as follows: 704 .RS +4 705 .TP 706 .ie t \(bu 707 .el o 708 If \fB-A\fR is not specified, \fIlibrary/object name\fR is an empty string. 709 .RE 710 .RS +4 711 .TP 712 .ie t \(bu 713 .el o 714 If \fB-A\fR is specified and the corresponding \fIfile\fR operand does not name 715 a library: 716 .sp 717 .in +2 718 .nf 719 \fB"%s: ", \fIfile\fR\fR 720 .fi 721 .in -2 722 .sp 723 724 .RE 725 .RS +4 726 .TP 727 .ie t \(bu 728 .el o 729 If \fB-A\fR is specified and the corresponding \fIfile\fR operand names a 730 library. In this case, \fIobject file\fR names the object file in the library 731 containing the symbol being described: 732 .sp 733 .in +2 734 .nf 735 \fB"%s[%s]: ", \fIfile\fR, \fIobject file\fR\fR 736 .fi 737 .in -2 738 .sp 739 740 .RE 741 .sp 742 .LP 743 If \fB-A\fR is not specified, then if more than one \fIfile\fR operand is 744 specified or if only one \fIfile\fR operand is specified and it names a 745 library, \fBnm\fR writes a line identifying the object containing the following 746 symbols before the lines containing those symbols, in the form: 747 .RS +4 748 .TP 749 .ie t \(bu 750 .el o 751 If the corresponding \fIfile\fR operand does not name a library: 752 .sp 753 .in +2 754 .nf 755 \fB"%s:\en", \fIfile\fR\fR 756 .fi 757 .in -2 758 .sp 759 760 .RE 761 .RS +4 762 .TP 763 .ie t \(bu 764 .el o 765 If the corresponding \fIfile\fR operand names a library; in this case, 766 \fIobject file\fR is the name of the file in the library containing the 767 following symbols: 768 .sp 769 .in +2 770 .nf 771 \fB"%s[%s]:\en", \fIfile\fR, \fIobject file\fR\fR 772 .fi 773 .in -2 774 .sp 775 776 .RE 777 .sp 778 .LP 779 If \fB-P\fR is specified, but \fB-t\fR is not, the format is as if \fB-t\fR 780 \fBx\fR had been specified. 781 .SH ENVIRONMENT VARIABLES 782 .sp 783 .LP 784 See \fBenviron\fR(5) for descriptions of the following environment variables 785 that affect the execution of \fBnm\fR: \fBLANG\fR, \fBLC_ALL\fR, 786 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. 787 .SH EXIT STATUS 788 .sp 789 .LP 790 The following exit values are returned: 791 .sp 792 .ne 2 793 .na 794 \fB\fB0\fR\fR 795 .ad 796 .RS 6n 797 Successful completion. 798 .RE 799 800 .sp 801 .ne 2 802 .na 803 \fB\fB>0\fR\fR 804 .ad 805 .RS 6n 806 An error occurred. 807 .RE 808 809 .SH ATTRIBUTES 810 .sp 811 .LP 812 See \fBattributes\fR(5) for descriptions of the following attributes: 813 .SH /USR/XPG4/BIN/NM 814 .sp 815 816 .sp 817 .TS 818 box; 819 c | c 820 l | l . 821 ATTRIBUTE TYPE ATTRIBUTE VALUE 822 _ 823 Interface Stability Committed 824 .TE 825 826 .SH SEE ALSO 827 .sp 828 .LP 829 \fBar\fR(1), \fBas\fR(1), \fBdump\fR(1), \fBld\fR(1), \fBld.so.1\fR(1), 830 \fBar.h\fR(3HEAD), \fBa.out\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), 831 \fBstandards\fR(5) 832 .SH NOTES 833 .sp 834 .LP 835 The following options are obsolete because of changes to the object file format 836 and might be deleted in a future release. 837 .sp 838 .ne 2 839 .na 840 \fB\fB-e\fR\fR 841 .ad 842 .RS 6n 843 Prints only external and static symbols. The symbol table now contains only 844 static and external symbols. Automatic symbols no longer appear in the symbol 845 table. They do appear in the debugging information produced by \fBcc\fR 846 \fB-g\fR, which can be examined using \fBdump\fR(1). 847 .RE 848 849 .sp 850 .ne 2 851 .na 852 \fB\fB-f\fR\fR 853 .ad 854 .RS 6n 855 Produces full output. Redundant symbols (such as \fB\&.text\fR, \fB\&.data\fR, 856 and so forth), which existed previously, do not exist and producing full output 857 is identical to the default output. 858 .RE 859 860 .sp 861 .ne 2 862 .na 863 \fB\fB-T\fR\fR 864 .ad 865 .RS 6n 866 By default, \fBnm\fR prints the entire name of the symbols listed. Since symbol 867 names have been moved to the last column, the problem of overflow is removed 868 and it is no longer necessary to truncate the symbol name. 869 .RE 870