llvm-nm.rst 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. llvm-nm - list LLVM bitcode and object file's symbol table
  2. ==========================================================
  3. .. program:: llvm-nm
  4. SYNOPSIS
  5. --------
  6. :program:`llvm-nm` [*options*] [*filenames...*]
  7. DESCRIPTION
  8. -----------
  9. The :program:`llvm-nm` utility lists the names of symbols from LLVM bitcode
  10. files, object files, and archives. Each symbol is listed along with some simple
  11. information about its provenance. If no filename is specified, *a.out* is used
  12. as the input. If *-* is used as a filename, :program:`llvm-nm` will read a file
  13. from its standard input stream.
  14. :program:`llvm-nm`'s default output format is the traditional BSD :program:`nm`
  15. output format. Each such output record consists of an (optional) 8-digit
  16. hexadecimal address, followed by a type code character, followed by a name, for
  17. each symbol. One record is printed per line; fields are separated by spaces.
  18. When the address is omitted, it is replaced by 8 spaces.
  19. The supported type code characters are as follows. Where both lower and
  20. upper-case characters are listed for the same meaning, a lower-case character
  21. represents a local symbol, whilst an upper-case character represents a global
  22. (external) symbol:
  23. a, A
  24. Absolute symbol.
  25. b, B
  26. Uninitialized data (bss) object.
  27. C
  28. Common symbol. Multiple definitions link together into one definition.
  29. d, D
  30. Writable data object.
  31. i, I
  32. COFF: .idata symbol or symbol in a section with IMAGE_SCN_LNK_INFO set.
  33. n
  34. ELF: local symbol from non-alloc section.
  35. COFF: debug symbol.
  36. N
  37. ELF: debug section symbol, or global symbol from non-alloc section.
  38. s, S
  39. COFF: section symbol.
  40. Mach-O: absolute symbol or symbol from a section other than __TEXT_EXEC __text,
  41. __TEXT __text, __DATA __data, or __DATA __bss.
  42. r, R
  43. Read-only data object.
  44. t, T
  45. Code (text) object.
  46. u
  47. ELF: GNU unique symbol.
  48. U
  49. Named object is undefined in this file.
  50. v
  51. ELF: Undefined weak object. It is not a link failure if the object is not
  52. defined.
  53. V
  54. ELF: Defined weak object symbol. This definition will only be used if no
  55. regular definitions exist in a link. If multiple weak definitions and no
  56. regular definitions exist, one of the weak definitions will be used.
  57. w
  58. Undefined weak symbol other than an ELF object symbol. It is not a link failure
  59. if the symbol is not defined.
  60. W
  61. Defined weak symbol other than an ELF object symbol. This definition will only
  62. be used if no regular definitions exist in a link. If multiple weak definitions
  63. and no regular definitions exist, one of the weak definitions will be used.
  64. \-
  65. Mach-O: N_STAB symbol.
  66. ?
  67. Something unrecognizable.
  68. Because LLVM bitcode files typically contain objects that are not considered to
  69. have addresses until they are linked into an executable image or dynamically
  70. compiled "just-in-time", :program:`llvm-nm` does not print an address for any
  71. symbol in an LLVM bitcode file, even symbols which are defined in the bitcode
  72. file.
  73. OPTIONS
  74. -------
  75. .. program:: llvm-nm
  76. .. option:: -B
  77. Use BSD output format. Alias for ``--format=bsd``.
  78. .. option:: --debug-syms, -a
  79. Show all symbols, even those usually suppressed.
  80. .. option:: --defined-only, -U
  81. Print only symbols defined in this file.
  82. .. option:: --demangle, -C
  83. Demangle symbol names.
  84. .. option:: --dynamic, -D
  85. Display dynamic symbols instead of normal symbols.
  86. .. option:: --extern-only, -g
  87. Print only symbols whose definitions are external; that is, accessible from
  88. other files.
  89. .. option:: --format=<format>, -f
  90. Select an output format; *format* may be *sysv*, *posix*, *darwin*, or *bsd*.
  91. The default is *bsd*.
  92. .. option:: --help, -h
  93. Print a summary of command-line options and their meanings.
  94. .. option:: --help-list
  95. Print an uncategorized summary of command-line options and their meanings.
  96. .. option:: --just-symbol-name, -j
  97. Print just the symbol names.
  98. .. option:: -m
  99. Use Darwin format. Alias for ``--format=darwin``.
  100. .. option:: --no-demangle
  101. Don't demangle symbol names. This is the default.
  102. .. option:: --no-llvm-bc
  103. Disable the LLVM bitcode reader.
  104. .. option:: --no-sort, -p
  105. Show symbols in the order encountered.
  106. .. option:: --no-weak, -W
  107. Don't print weak symbols.
  108. .. option:: --numeric-sort, -n, -v
  109. Sort symbols by address.
  110. .. option:: --portability, -P
  111. Use POSIX.2 output format. Alias for ``--format=posix``.
  112. .. option:: --print-armap, -M
  113. Print the archive symbol table, in addition to the symbols.
  114. .. option:: --print-file-name, -A, -o
  115. Precede each symbol with the file it came from.
  116. .. option:: --print-size, -S
  117. Show symbol size as well as address (not applicable for Mach-O).
  118. .. option:: --radix=<RADIX>, -t
  119. Specify the radix of the symbol address(es). Values accepted are *d* (decimal),
  120. *x* (hexadecimal) and *o* (octal).
  121. .. option:: --reverse-sort, -r
  122. Sort symbols in reverse order.
  123. .. option:: --size-sort
  124. Sort symbols by size.
  125. .. option:: --special-syms
  126. Ignored. For GNU compatibility only.
  127. .. option:: --undefined-only, -u
  128. Print only undefined symbols.
  129. .. option:: --version
  130. Display the version of the :program:`llvm-nm` executable. Does not stack with
  131. other commands.
  132. .. option:: --without-aliases
  133. Exclude aliases from the output.
  134. .. option:: @<FILE>
  135. Read command-line options from response file `<FILE>`.
  136. MACH-O SPECIFIC OPTIONS
  137. -----------------------
  138. .. option:: --add-dyldinfo
  139. Add symbols from the dyldinfo, if they are not already in the symbol table.
  140. This is the default.
  141. .. option:: --arch=<arch1[,arch2,...]>
  142. Dump the symbols from the specified architecture(s).
  143. .. option:: --dyldinfo-only
  144. Dump only symbols from the dyldinfo.
  145. .. option:: --no-dyldinfo
  146. Do not add any symbols from the dyldinfo.
  147. .. option:: -s=<segment section>
  148. Dump only symbols from this segment and section name.
  149. .. option:: -x
  150. Print symbol entry in hex.
  151. BUGS
  152. ----
  153. * :program:`llvm-nm` does not support the full set of arguments that GNU
  154. :program:`nm` does.
  155. EXIT STATUS
  156. -----------
  157. :program:`llvm-nm` exits with an exit code of zero.
  158. SEE ALSO
  159. --------
  160. :manpage:`llvm-ar(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`,
  161. :manpage:`llvm-readobj(1)`