Knowledge

nm (Unix)

Source 📝

1940: 1491: 1513: 1962: 1551: 879: 2003: 2027: 2022: 1504: 1499: 1544: 872: 1874: 1910: 1830: 1476: 1446: 834: 40: 2032: 1944: 1537: 1461: 87: 1996: 1529: 576: 1563: 1517: 1222: 891: 865: 857: 1560: 851: 230: 107: 674:
The differences between the outputs also show an example of solving the name mangling problem by using
1861: 1392: 1340: 54: 828: 2037: 177: 131: 126: 58: 1989: 1065: 1055: 114: 675: 1729: 1292: 1197: 1192: 833:: write the name list of an object file – Shell and Utilities Reference, 226: 138: 94: 1925: 1817: 1651: 1471: 1415: 1320: 1121: 1024: 1973: 1920: 1879: 1802: 1759: 1734: 1667: 1611: 1410: 1345: 1330: 1267: 1227: 1106: 1070: 964: 838: 119: 30: 2016: 1915: 1794: 1646: 1567: 1451: 1312: 1247: 1019: 994: 895: 195:
distinguishes between various symbol types. For example, it differentiates between a
158: 1889: 1754: 1641: 1425: 1325: 1242: 1237: 1141: 1050: 1014: 969: 242: 166: 35: 1807: 1764: 1749: 1739: 1361: 1335: 1272: 1262: 1252: 1217: 1207: 1202: 1085: 1075: 1029: 234: 181: 170: 144: 1693: 1591: 1177: 1136: 939: 909: 196: 185: 173: 48: 25: 1869: 1784: 1769: 1672: 1636: 1606: 1601: 1596: 1466: 1400: 1297: 1277: 1232: 1080: 1004: 989: 974: 959: 954: 949: 944: 223: 212: 204: 199:
that is supplied by an object module and a function that is required by it.
103: 1825: 1714: 1382: 1162: 1961: 1835: 1187: 1111: 814: 1688: 1172: 914: 845: 208: 1774: 1626: 1586: 1581: 1405: 1302: 1282: 1212: 1131: 1034: 1009: 984: 934: 929: 924: 919: 1969: 1894: 1851: 1779: 1724: 1719: 1616: 1456: 1430: 1366: 1287: 1182: 1167: 1126: 1116: 1060: 888: 219: 162: 99: 1533: 861: 1744: 1709: 1631: 1257: 1157: 1101: 999: 1621: 979: 218:
This command is shipped with a number of later versions of
207:, to help resolve problems arising from name conflicts and 654:
00000008 d _ZZ15global_functioniE21local_static_var_init
1977: 1903: 1860: 1844: 1816: 1793: 1702: 1681: 1660: 1574: 1439: 1391: 1375: 1354: 1311: 1150: 1094: 1043: 902: 651:
00000008 b _ZZ15global_functioniE16local_static_var
627:When the C++ compiler is used, the output differs: 137: 125: 113: 93: 83: 65: 47: 24: 211:name mangling, and to validate other parts of the 1997: 1545: 873: 8: 19: 2004: 1990: 1552: 1538: 1530: 1512: 880: 866: 858: 575:If the previous code is compiled with the 18: 680: 184:, shared-object files, and standalone 607:00000008 d local_static_var_init.1256 7: 1958: 1956: 14: 762:Static thread-local symbol (TLS) 754:Global thread-local symbol (TLS) 1960: 1939: 1938: 1511: 1490: 1489: 645:00000000 t _ZL15static_functionv 639:00000025 T _Z16global_function2v 604:00000004 b local_static_var.1255 669:00000036 T non_mangled_function 648:00000004 d _ZL15static_var_init 636:0000000a T _Z15global_functioni 613:00000036 T non_mangled_function 579:C compiler, the output of the 1: 854:Programmer's Manual, Volume 1 835:The Single UNIX Specification 1976:. You can help Knowledge by 270:* For C++ code compile with: 169:and their attributes from a 595:00000025 T global_function2 261:* For C code compile with: 237:ships an implementation of 2054: 1955: 663:00000000 D global_var_init 642:00000004 b _ZL10static_var 622:00000004 d static_var_init 616:00000000 t static_function 601:00000000 D global_var_init 592:0000000a T global_function 583:command is the following: 41:AT&T Bell Laboratories 1934: 1485: 165:command used to dump the 770:Global read-only symbol 746:Source file name symbol 629: 585: 252: 778:Local read-only symbol 698:Global absolute symbol 2028:Unix SUS2008 utilities 2023:Unix programming tools 1972:-related article is a 1564:command-line interface 1505:Unix SUS2008 utilities 1500:Standard Unix programs 892:command-line interface 706:Local absolute symbol 657:U __gxx_personality_v0 203:is used as an aid for 71:; 52 years ago 660:00000000 B global_var 619:00000000 b static_var 598:00000004 C global_var 426:local_static_var_init 399:local_static_var_init 69:November 3, 1971 1862:Software development 1393:Software development 504:non_mangled_function 786:Global text symbol 730:Global data symbol 683: 258:* File name: test.c 21: 794:Local text symbol 738:Local data symbol 714:Global bss symbol 681: 489:#ifdef __cplusplus 26:Original author(s) 1985: 1984: 1953: 1952: 1527: 1526: 837:, Version 4 from 806: 805: 802:Undefined symbol 722:Local bss symbol 273:* g++ -c test.cpp 227:operating systems 150: 149: 2045: 2006: 1999: 1992: 1964: 1957: 1942: 1941: 1682:User environment 1554: 1547: 1540: 1531: 1515: 1514: 1493: 1492: 1095:User environment 882: 875: 868: 859: 849: 848: 832: 831: 684: 670: 667: 664: 661: 658: 655: 652: 649: 646: 643: 640: 637: 633: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 589: 582: 571: 568: 565: 562: 559: 556: 553: 550: 547: 544: 541: 538: 535: 532: 529: 526: 523: 520: 517: 514: 511: 508: 505: 502: 499: 496: 493: 490: 487: 484: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 444:global_function2 442: 439: 436: 433: 432:local_static_var 430: 427: 424: 421: 418: 415: 412: 411:local_static_var 409: 406: 403: 400: 397: 394: 391: 388: 387:local_static_var 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 337: 334: 331: 328: 325: 322: 319: 316: 313: 310: 307: 304: 301: 298: 295: 292: 289: 286: 283: 280: 277: 274: 271: 268: 265: 262: 259: 256: 249:nm output sample 240: 202: 194: 191:The output from 176:file (including 156: 95:Operating system 79: 77: 72: 22: 2053: 2052: 2048: 2047: 2046: 2044: 2043: 2042: 2033:Plan 9 commands 2013: 2012: 2011: 2010: 1954: 1949: 1930: 1899: 1856: 1840: 1812: 1789: 1703:Text processing 1698: 1677: 1656: 1570: 1558: 1528: 1523: 1481: 1435: 1387: 1371: 1350: 1307: 1151:Text processing 1146: 1090: 1039: 898: 886: 844: 843: 827: 826: 823: 811: 672: 671: 668: 666:0000003b T main 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 631: 625: 624: 621: 618: 615: 612: 610:0000003b T main 609: 606: 603: 600: 597: 594: 591: 587: 580: 573: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 542: 539: 536: 533: 530: 527: 524: 521: 518: 515: 513:// I do nothing 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 363:global_function 362: 359: 356: 353: 350: 347: 344: 341: 339:static_function 338: 335: 332: 329: 326: 323: 321:static_var_init 320: 317: 314: 311: 308: 305: 302: 299: 296: 293: 291:global_var_init 290: 287: 284: 281: 278: 275: 272: 269: 266: 264:* gcc -c test.c 263: 260: 257: 254: 251: 241:as part of the 238: 200: 192: 152: 75: 73: 70: 66:Initial release 38: 34: 17: 12: 11: 5: 2051: 2049: 2041: 2040: 2035: 2030: 2025: 2015: 2014: 2009: 2008: 2001: 1994: 1986: 1983: 1982: 1965: 1951: 1950: 1948: 1947: 1935: 1932: 1931: 1929: 1928: 1923: 1918: 1913: 1907: 1905: 1901: 1900: 1898: 1897: 1892: 1887: 1882: 1877: 1872: 1866: 1864: 1858: 1857: 1855: 1854: 1848: 1846: 1842: 1841: 1839: 1838: 1833: 1828: 1822: 1820: 1814: 1813: 1811: 1810: 1805: 1799: 1797: 1795:Shell builtins 1791: 1790: 1788: 1787: 1782: 1777: 1772: 1767: 1762: 1757: 1752: 1747: 1742: 1737: 1732: 1727: 1722: 1717: 1712: 1706: 1704: 1700: 1699: 1697: 1696: 1691: 1685: 1683: 1679: 1678: 1676: 1675: 1670: 1664: 1662: 1658: 1657: 1655: 1654: 1649: 1644: 1639: 1634: 1629: 1624: 1619: 1614: 1609: 1604: 1599: 1594: 1589: 1584: 1578: 1576: 1572: 1571: 1568:shell builtins 1559: 1557: 1556: 1549: 1542: 1534: 1525: 1524: 1522: 1521: 1509: 1508: 1507: 1502: 1486: 1483: 1482: 1480: 1479: 1477:true and false 1474: 1469: 1464: 1459: 1454: 1449: 1443: 1441: 1437: 1436: 1434: 1433: 1428: 1423: 1418: 1413: 1408: 1403: 1397: 1395: 1389: 1388: 1386: 1385: 1379: 1377: 1373: 1372: 1370: 1369: 1364: 1358: 1356: 1352: 1351: 1349: 1348: 1343: 1338: 1333: 1328: 1323: 1317: 1315: 1313:Shell builtins 1309: 1308: 1306: 1305: 1300: 1295: 1290: 1285: 1280: 1275: 1270: 1265: 1260: 1255: 1250: 1245: 1240: 1235: 1230: 1225: 1220: 1215: 1210: 1205: 1200: 1195: 1190: 1185: 1180: 1175: 1170: 1165: 1160: 1154: 1152: 1148: 1147: 1145: 1144: 1139: 1134: 1129: 1124: 1119: 1114: 1109: 1104: 1098: 1096: 1092: 1091: 1089: 1088: 1083: 1078: 1073: 1068: 1063: 1058: 1053: 1047: 1045: 1041: 1040: 1038: 1037: 1032: 1027: 1022: 1017: 1012: 1007: 1002: 997: 992: 987: 982: 977: 972: 967: 962: 957: 952: 947: 942: 937: 932: 927: 922: 917: 912: 906: 904: 900: 899: 896:shell builtins 887: 885: 884: 877: 870: 862: 856: 855: 841: 839:The Open Group 822: 821:External links 819: 818: 817: 810: 807: 804: 803: 800: 796: 795: 792: 788: 787: 784: 780: 779: 776: 772: 771: 768: 764: 763: 760: 756: 755: 752: 748: 747: 744: 740: 739: 736: 732: 731: 728: 724: 723: 720: 716: 715: 712: 708: 707: 704: 700: 699: 696: 692: 691: 688: 630: 586: 253: 250: 247: 182:object modules 148: 147: 141: 135: 134: 129: 123: 122: 120:Cross-platform 117: 111: 110: 97: 91: 90: 85: 81: 80: 67: 63: 62: 51: 45: 44: 31:Dennis Ritchie 28: 15: 13: 10: 9: 6: 4: 3: 2: 2050: 2039: 2036: 2034: 2031: 2029: 2026: 2024: 2021: 2020: 2018: 2007: 2002: 2000: 1995: 1993: 1988: 1987: 1981: 1979: 1975: 1971: 1966: 1963: 1959: 1946: 1937: 1936: 1933: 1927: 1924: 1922: 1919: 1917: 1914: 1912: 1909: 1908: 1906: 1904:Miscellaneous 1902: 1896: 1893: 1891: 1888: 1886: 1883: 1881: 1878: 1876: 1873: 1871: 1868: 1867: 1865: 1863: 1859: 1853: 1850: 1849: 1847: 1843: 1837: 1834: 1832: 1829: 1827: 1824: 1823: 1821: 1819: 1815: 1809: 1806: 1804: 1801: 1800: 1798: 1796: 1792: 1786: 1783: 1781: 1778: 1776: 1773: 1771: 1768: 1766: 1763: 1761: 1758: 1756: 1753: 1751: 1748: 1746: 1743: 1741: 1738: 1736: 1733: 1731: 1728: 1726: 1723: 1721: 1718: 1716: 1713: 1711: 1708: 1707: 1705: 1701: 1695: 1692: 1690: 1687: 1686: 1684: 1680: 1674: 1671: 1669: 1666: 1665: 1663: 1659: 1653: 1650: 1648: 1645: 1643: 1640: 1638: 1635: 1633: 1630: 1628: 1625: 1623: 1620: 1618: 1615: 1613: 1610: 1608: 1605: 1603: 1600: 1598: 1595: 1593: 1590: 1588: 1585: 1583: 1580: 1579: 1577: 1573: 1569: 1566:programs and 1565: 1562: 1555: 1550: 1548: 1543: 1541: 1536: 1535: 1532: 1520: 1519: 1510: 1506: 1503: 1501: 1498: 1497: 1496: 1488: 1487: 1484: 1478: 1475: 1473: 1470: 1468: 1465: 1463: 1460: 1458: 1455: 1453: 1450: 1448: 1445: 1444: 1442: 1440:Miscellaneous 1438: 1432: 1429: 1427: 1424: 1422: 1419: 1417: 1414: 1412: 1409: 1407: 1404: 1402: 1399: 1398: 1396: 1394: 1390: 1384: 1381: 1380: 1378: 1376:Documentation 1374: 1368: 1365: 1363: 1360: 1359: 1357: 1353: 1347: 1344: 1342: 1339: 1337: 1334: 1332: 1329: 1327: 1324: 1322: 1319: 1318: 1316: 1314: 1310: 1304: 1301: 1299: 1296: 1294: 1291: 1289: 1286: 1284: 1281: 1279: 1276: 1274: 1271: 1269: 1266: 1264: 1261: 1259: 1256: 1254: 1251: 1249: 1246: 1244: 1241: 1239: 1236: 1234: 1231: 1229: 1226: 1224: 1221: 1219: 1216: 1214: 1211: 1209: 1206: 1204: 1201: 1199: 1196: 1194: 1191: 1189: 1186: 1184: 1181: 1179: 1176: 1174: 1171: 1169: 1166: 1164: 1161: 1159: 1156: 1155: 1153: 1149: 1143: 1140: 1138: 1135: 1133: 1130: 1128: 1125: 1123: 1120: 1118: 1115: 1113: 1110: 1108: 1105: 1103: 1100: 1099: 1097: 1093: 1087: 1084: 1082: 1079: 1077: 1074: 1072: 1069: 1067: 1064: 1062: 1059: 1057: 1054: 1052: 1049: 1048: 1046: 1042: 1036: 1033: 1031: 1028: 1026: 1023: 1021: 1018: 1016: 1013: 1011: 1008: 1006: 1003: 1001: 998: 996: 993: 991: 988: 986: 983: 981: 978: 976: 973: 971: 968: 966: 963: 961: 958: 956: 953: 951: 948: 946: 943: 941: 938: 936: 933: 931: 928: 926: 923: 921: 918: 916: 913: 911: 908: 907: 905: 901: 897: 894:programs and 893: 890: 883: 878: 876: 871: 869: 864: 863: 860: 853: 850: –  847: 842: 840: 836: 830: 825: 824: 820: 816: 813: 812: 808: 801: 798: 797: 793: 790: 789: 785: 782: 781: 777: 774: 773: 769: 766: 765: 761: 758: 757: 753: 750: 749: 745: 742: 741: 737: 734: 733: 729: 726: 725: 721: 718: 717: 713: 710: 709: 705: 702: 701: 697: 694: 693: 689: 686: 685: 682:Symbol types 679: 678:in C++ code. 677: 628: 584: 578: 495:"C" 248: 246: 244: 236: 232: 228: 225: 221: 216: 214: 210: 206: 198: 189: 187: 183: 179: 175: 172: 168: 164: 160: 159:name mangling 155: 146: 142: 140: 136: 133: 130: 128: 124: 121: 118: 116: 112: 109: 105: 101: 98: 96: 92: 89: 86: 82: 68: 64: 60: 56: 52: 50: 46: 42: 37: 32: 29: 27: 23: 1978:expanding it 1967: 1884: 1516: 1494: 1420: 690:Description 687:Symbol type 673: 626: 574: 243:GNU Binutils 217: 190: 167:symbol table 153: 151: 49:Developer(s) 36:Ken Thompson 16:Unix command 1826:ip/ipconfig 1575:File system 903:File system 235:GNU Project 186:executables 180:, compiled 145:MIT License 55:open-source 2038:Unix stubs 2017:Categories 1818:Networking 1495:Categories 676:extern "C" 549:static_var 537:global_var 309:static_var 282:global_var 229:including 174:executable 84:Written in 76:1971-11-03 61:developers 59:commercial 1845:Searching 1661:Processes 1355:Searching 1044:Processes 634:nmtest.o 590:nmtest.o 245:package. 213:toolchain 205:debugging 178:libraries 104:Unix-like 1945:Category 1715:basename 1163:basename 809:See also 197:function 143:Plan 9: 115:Platform 53:Various 1921:fortune 1836:netstat 1831:ip/ping 1760:strings 1268:strings 1188:dirname 1112:logname 1061:crontab 815:objdump 224:similar 161:) is a 139:License 132:Command 74: ( 1943:  1689:passwd 1561:Plan 9 1248:printf 1173:csplit 915:chattr 852:Plan 9 561:return 498:#endif 492:extern 471:return 423:return 393:static 381:static 348:return 333:static 315:static 303:static 233:. The 231:Plan 9 171:binary 108:Plan 9 1968:This 1926:sleep 1890:strip 1775:troff 1755:spell 1652:touch 1642:split 1627:mkdir 1587:chgrp 1582:chmod 1472:sleep 1426:strip 1406:ctags 1341:unset 1321:alias 1303:xargs 1283:troff 1243:patch 1238:paste 1213:iconv 1142:write 1132:uname 1035:umask 1025:touch 1015:split 1010:rmdir 985:mkdir 970:fuser 935:cksum 930:chgrp 925:chown 920:chmod 846:nm(1) 1974:stub 1970:Unix 1895:yacc 1852:grep 1808:test 1803:echo 1780:uniq 1765:tail 1750:sort 1740:join 1725:diff 1720:comm 1668:kill 1617:gzip 1612:file 1518:List 1457:expr 1431:yacc 1416:make 1367:grep 1362:find 1346:wait 1336:test 1331:echo 1288:uniq 1273:tail 1263:sort 1253:read 1228:more 1218:join 1208:head 1203:fold 1183:diff 1168:comm 1127:tput 1122:talk 1117:mesg 1107:exit 1086:time 1076:nice 1071:kill 1030:type 965:file 889:Unix 528:void 522:main 501:void 222:and 220:Unix 163:Unix 127:Type 100:Unix 57:and 1916:cal 1880:lex 1875:hoc 1745:sed 1735:eqn 1710:awk 1694:who 1647:tee 1632:pwd 1592:cmp 1452:cal 1411:lex 1383:man 1258:sed 1178:cut 1158:awk 1137:who 1102:env 1020:tee 1000:pwd 995:pax 940:cmp 910:cat 577:gcc 519:int 462:int 453:int 441:int 396:int 384:int 369:int 360:int 336:int 318:int 306:int 288:int 279:int 209:C++ 188:). 2019:: 1911:bc 1885:nm 1870:ar 1785:wc 1770:tr 1730:ed 1673:ps 1637:rm 1622:ls 1607:du 1602:dd 1597:cp 1467:od 1462:lp 1447:bc 1421:nm 1401:ar 1326:cd 1298:wc 1293:vi 1278:tr 1233:nl 1223:m4 1198:ex 1193:ed 1081:ps 1066:fg 1056:bg 1051:at 1005:rm 990:mv 980:ls 975:ln 960:df 955:du 950:dd 945:cp 829:nm 799:U 791:t 783:T 775:r 767:R 759:l 751:L 743:f 735:d 727:D 719:b 711:B 703:a 695:A 632:# 588:# 581:nm 507:() 447:() 342:() 327:25 297:26 276:*/ 255:/* 239:nm 215:. 201:nm 193:nm 154:nm 106:, 102:, 20:nm 2005:e 1998:t 1991:v 1980:. 1553:e 1546:t 1539:v 881:e 874:t 867:v 570:} 567:; 564:0 558:; 555:2 552:= 546:; 543:1 540:= 534:{ 531:) 525:( 516:} 510:{ 486:} 483:; 480:y 477:+ 474:x 468:; 465:y 459:; 456:x 450:{ 438:} 435:; 429:+ 420:; 417:p 414:= 408:; 405:5 402:= 390:; 378:{ 375:) 372:p 366:( 357:} 354:; 351:0 345:{ 330:; 324:= 312:; 300:; 294:= 285:; 267:* 157:( 88:C 78:) 43:) 39:( 33:,

Index

Original author(s)
Dennis Ritchie
Ken Thompson
AT&T Bell Laboratories
Developer(s)
open-source
commercial
C
Operating system
Unix
Unix-like
Plan 9
Platform
Cross-platform
Type
Command
License
MIT License
name mangling
Unix
symbol table
binary
executable
libraries
object modules
executables
function
debugging
C++
toolchain

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.