Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 1 | llvm-nm - list LLVM bitcode and object file's symbol table |
| 2 | ========================================================== |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 3 | |
| 4 | |
| 5 | SYNOPSIS |
| 6 | -------- |
| 7 | |
| 8 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 9 | :program:`llvm-nm` [*options*] [*filenames...*] |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 10 | |
| 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
| 14 | |
| 15 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 16 | The :program:`llvm-nm` utility lists the names of symbols from the LLVM bitcode |
| 17 | files, object files, or :program:`ar` archives containing them, named on the |
| 18 | command line. Each symbol is listed along with some simple information about its |
| 19 | provenance. If no file name is specified, or *-* is used as a file name, |
| 20 | :program:`llvm-nm` will process a file on its standard input stream. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 21 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 22 | :program:`llvm-nm`'s default output format is the traditional BSD :program:`nm` |
| 23 | output format. Each such output record consists of an (optional) 8-digit |
| 24 | hexadecimal address, followed by a type code character, followed by a name, for |
| 25 | each symbol. One record is printed per line; fields are separated by spaces. |
| 26 | When the address is omitted, it is replaced by 8 spaces. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 27 | |
| 28 | Type code characters currently supported, and their meanings, are as follows: |
| 29 | |
| 30 | |
| 31 | U |
| 32 | |
| 33 | Named object is referenced but undefined in this bitcode file |
| 34 | |
| 35 | |
| 36 | |
| 37 | C |
| 38 | |
| 39 | Common (multiple definitions link together into one def) |
| 40 | |
| 41 | |
| 42 | |
| 43 | W |
| 44 | |
| 45 | Weak reference (multiple definitions link together into zero or one definitions) |
| 46 | |
| 47 | |
| 48 | |
| 49 | t |
| 50 | |
| 51 | Local function (text) object |
| 52 | |
| 53 | |
| 54 | |
| 55 | T |
| 56 | |
| 57 | Global function (text) object |
| 58 | |
| 59 | |
| 60 | |
| 61 | d |
| 62 | |
| 63 | Local data object |
| 64 | |
| 65 | |
| 66 | |
| 67 | D |
| 68 | |
| 69 | Global data object |
| 70 | |
| 71 | |
| 72 | |
| 73 | ? |
| 74 | |
| 75 | Something unrecognizable |
| 76 | |
| 77 | |
| 78 | |
| 79 | Because LLVM bitcode files typically contain objects that are not considered to |
| 80 | have addresses until they are linked into an executable image or dynamically |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 81 | compiled "just-in-time", :program:`llvm-nm` does not print an address for any |
| 82 | symbol in a LLVM bitcode file, even symbols which are defined in the bitcode |
| 83 | file. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 84 | |
| 85 | |
| 86 | OPTIONS |
| 87 | ------- |
| 88 | |
| 89 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 90 | .. program:: llvm-nm |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 91 | |
| 92 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 93 | .. option:: -B (default) |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 94 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 95 | Use BSD output format. Alias for :option:`--format=bsd`. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 96 | |
| 97 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 98 | .. option:: -P |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 99 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 100 | Use POSIX.2 output format. Alias for :option:`--format=posix`. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 101 | |
| 102 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 103 | .. option:: --debug-syms, -a |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 104 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 105 | Show all symbols, even debugger only. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 106 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 107 | |
| 108 | .. option:: --defined-only |
| 109 | |
| 110 | Print only symbols defined in this file (as opposed to |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 111 | symbols which may be referenced by objects in this file, but not |
| 112 | defined in this file.) |
| 113 | |
| 114 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 115 | .. option:: --dynamic, -D |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 116 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 117 | Display dynamic symbols instead of normal symbols. |
| 118 | |
| 119 | |
| 120 | .. option:: --extern-only, -g |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 121 | |
| 122 | Print only symbols whose definitions are external; that is, accessible |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 123 | from other files. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 124 | |
| 125 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 126 | .. option:: --format=format, -f format |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 127 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 128 | Select an output format; *format* may be *sysv*, *posix*, or *bsd*. The default |
| 129 | is *bsd*. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 130 | |
| 131 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 132 | .. option:: -help |
| 133 | |
| 134 | Print a summary of command-line options and their meanings. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 135 | |
| 136 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 137 | .. option:: --no-sort, -p |
| 138 | |
| 139 | Shows symbols in order encountered. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 140 | |
| 141 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 142 | .. option:: --numeric-sort, -n, -v |
| 143 | |
| 144 | Sort symbols by address. |
| 145 | |
| 146 | |
| 147 | .. option:: --print-file-name, -A, -o |
| 148 | |
| 149 | Precede each symbol with the file it came from. |
| 150 | |
| 151 | |
| 152 | .. option:: --print-size, -S |
| 153 | |
| 154 | Show symbol size instead of address. |
| 155 | |
| 156 | |
| 157 | .. option:: --size-sort |
| 158 | |
| 159 | Sort symbols by size. |
| 160 | |
| 161 | |
| 162 | .. option:: --undefined-only, -u |
| 163 | |
| 164 | Print only symbols referenced but not defined in this file. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 165 | |
| 166 | |
| 167 | BUGS |
| 168 | ---- |
| 169 | |
| 170 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 171 | * :program:`llvm-nm` cannot demangle C++ mangled names, like GNU :program:`nm` |
| 172 | can. |
| 173 | |
| 174 | * :program:`llvm-nm` does not support the full set of arguments that GNU |
| 175 | :program:`nm` does. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 176 | |
| 177 | |
| 178 | EXIT STATUS |
| 179 | ----------- |
| 180 | |
| 181 | |
Michael J. Spencer | 4d61664 | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 182 | :program:`llvm-nm` exits with an exit code of zero. |
Daniel Dunbar | 3b709d5 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 183 | |
| 184 | |
| 185 | SEE ALSO |
| 186 | -------- |
| 187 | |
| 188 | |
| 189 | llvm-dis|llvm-dis, ar(1), nm(1) |