Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 1 | llvm-nm - list LLVM bitcode and object file's symbol table |
| 2 | ========================================================== |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 3 | |
James Henderson | a056684 | 2019-06-27 13:24:46 +0000 | [diff] [blame] | 4 | .. program:: llvm-nm |
| 5 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 6 | SYNOPSIS |
| 7 | -------- |
| 8 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 9 | :program:`llvm-nm` [*options*] [*filenames...*] |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 10 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 11 | DESCRIPTION |
| 12 | ----------- |
| 13 | |
James Henderson | 65d7511 | 2019-07-09 10:40:50 +0000 | [diff] [blame] | 14 | The :program:`llvm-nm` utility lists the names of symbols from LLVM bitcode |
| 15 | files, object files, and archives. Each symbol is listed along with some simple |
Alex Brachet | 2eacf69 | 2019-07-16 15:33:43 +0000 | [diff] [blame] | 16 | information about its provenance. If no filename is specified, *a.out* is used |
| 17 | as the input. If *-* is used as a filename, :program:`llvm-nm` will read a file |
| 18 | from its standard input stream. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 19 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 20 | :program:`llvm-nm`'s default output format is the traditional BSD :program:`nm` |
James Henderson | 65d7511 | 2019-07-09 10:40:50 +0000 | [diff] [blame] | 21 | output format. Each such output record consists of an (optional) 8-digit |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 22 | hexadecimal address, followed by a type code character, followed by a name, for |
James Henderson | 65d7511 | 2019-07-09 10:40:50 +0000 | [diff] [blame] | 23 | each symbol. One record is printed per line; fields are separated by spaces. |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 24 | When the address is omitted, it is replaced by 8 spaces. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 25 | |
James Henderson | 65d7511 | 2019-07-09 10:40:50 +0000 | [diff] [blame] | 26 | The supported type code characters are as follows. Where both lower and |
| 27 | upper-case characters are listed for the same meaning, a lower-case character |
| 28 | represents a local symbol, whilst an upper-case character represents a global |
| 29 | (external) symbol: |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 30 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 31 | a, A |
| 32 | |
| 33 | Absolute symbol. |
| 34 | |
| 35 | b, B |
| 36 | |
Nico Weber | bb69208 | 2019-09-13 14:58:24 +0000 | [diff] [blame] | 37 | Uninitialized data (bss) object. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 38 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 39 | C |
| 40 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 41 | Common symbol. Multiple definitions link together into one definition. |
| 42 | |
| 43 | d, D |
| 44 | |
| 45 | Writable data object. |
| 46 | |
| 47 | i, I |
| 48 | |
| 49 | COFF: .idata symbol or symbol in a section with IMAGE_SCN_LNK_INFO set. |
| 50 | |
| 51 | n |
| 52 | |
| 53 | ELF: local symbol from non-alloc section. |
| 54 | |
| 55 | COFF: debug symbol. |
| 56 | |
| 57 | N |
| 58 | |
| 59 | ELF: debug section symbol, or global symbol from non-alloc section. |
| 60 | |
| 61 | s, S |
| 62 | |
| 63 | COFF: section symbol. |
| 64 | |
| 65 | Mach-O: absolute symbol or symbol from a section other than __TEXT_EXEC __text, |
| 66 | __TEXT __text, __DATA __data, or __DATA __bss. |
| 67 | |
| 68 | r, R |
| 69 | |
| 70 | Read-only data object. |
| 71 | |
| 72 | t, T |
| 73 | |
| 74 | Code (text) object. |
| 75 | |
| 76 | u |
| 77 | |
| 78 | ELF: GNU unique symbol. |
| 79 | |
| 80 | U |
| 81 | |
| 82 | Named object is undefined in this file. |
| 83 | |
| 84 | v |
| 85 | |
| 86 | ELF: Undefined weak object. It is not a link failure if the object is not |
| 87 | defined. |
| 88 | |
| 89 | V |
| 90 | |
| 91 | ELF: Defined weak object symbol. This definition will only be used if no |
| 92 | regular definitions exist in a link. If multiple weak definitions and no |
Nico Weber | bb69208 | 2019-09-13 14:58:24 +0000 | [diff] [blame] | 93 | regular definitions exist, one of the weak definitions will be used. |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 94 | |
| 95 | w |
| 96 | |
| 97 | Undefined weak symbol other than an ELF object symbol. It is not a link failure |
| 98 | if the symbol is not defined. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 99 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 100 | W |
| 101 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 102 | Defined weak symbol other than an ELF object symbol. This definition will only |
| 103 | be used if no regular definitions exist in a link. If multiple weak definitions |
Nico Weber | bb69208 | 2019-09-13 14:58:24 +0000 | [diff] [blame] | 104 | and no regular definitions exist, one of the weak definitions will be used. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 105 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 106 | \- |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 107 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 108 | Mach-O: N_STAB symbol. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 109 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 110 | ? |
| 111 | |
James Henderson | 3519d55 | 2019-06-24 09:53:02 +0000 | [diff] [blame] | 112 | Something unrecognizable. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 113 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 114 | Because LLVM bitcode files typically contain objects that are not considered to |
| 115 | have addresses until they are linked into an executable image or dynamically |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 116 | compiled "just-in-time", :program:`llvm-nm` does not print an address for any |
Daniel Dunbar | 06b9f9e | 2013-08-16 23:30:19 +0000 | [diff] [blame] | 117 | symbol in an LLVM bitcode file, even symbols which are defined in the bitcode |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 118 | file. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 119 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 120 | OPTIONS |
| 121 | ------- |
| 122 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 123 | .. program:: llvm-nm |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 124 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 125 | .. option:: -B |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 126 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 127 | Use BSD output format. Alias for ``--format=bsd``. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 128 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 129 | .. option:: --debug-syms, -a |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 130 | |
James Henderson | 65d7511 | 2019-07-09 10:40:50 +0000 | [diff] [blame] | 131 | Show all symbols, even those usually suppressed. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 132 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 133 | .. option:: --defined-only, -U |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 134 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 135 | Print only symbols defined in this file. |
| 136 | |
| 137 | .. option:: --demangle, -C |
| 138 | |
| 139 | Demangle symbol names. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 140 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 141 | .. option:: --dynamic, -D |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 142 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 143 | Display dynamic symbols instead of normal symbols. |
| 144 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 145 | .. option:: --extern-only, -g |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 146 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 147 | Print only symbols whose definitions are external; that is, accessible from |
| 148 | other files. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 149 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 150 | .. option:: --format=<format>, -f |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 151 | |
James Henderson | 5058ae0 | 2019-06-11 15:58:10 +0000 | [diff] [blame] | 152 | Select an output format; *format* may be *sysv*, *posix*, *darwin*, or *bsd*. |
| 153 | The default is *bsd*. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 154 | |
James Henderson | 224410b | 2019-06-11 14:55:31 +0000 | [diff] [blame] | 155 | .. option:: --help, -h |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 156 | |
| 157 | Print a summary of command-line options and their meanings. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 158 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 159 | .. option:: --help-list |
| 160 | |
| 161 | Print an uncategorized summary of command-line options and their meanings. |
| 162 | |
| 163 | .. option:: --just-symbol-name, -j |
| 164 | |
| 165 | Print just the symbol names. |
| 166 | |
| 167 | .. option:: -m |
| 168 | |
| 169 | Use Darwin format. Alias for ``--format=darwin``. |
| 170 | |
| 171 | .. option:: --no-demangle |
| 172 | |
| 173 | Don't demangle symbol names. This is the default. |
| 174 | |
| 175 | .. option:: --no-llvm-bc |
| 176 | |
| 177 | Disable the LLVM bitcode reader. |
| 178 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 179 | .. option:: --no-sort, -p |
| 180 | |
James Henderson | 73e3336 | 2019-07-15 16:40:34 +0000 | [diff] [blame] | 181 | Show symbols in the order encountered. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 182 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 183 | .. option:: --no-weak, -W |
| 184 | |
| 185 | Don't print weak symbols. |
| 186 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 187 | .. option:: --numeric-sort, -n, -v |
| 188 | |
| 189 | Sort symbols by address. |
| 190 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 191 | .. option:: --portability, -P |
| 192 | |
| 193 | Use POSIX.2 output format. Alias for ``--format=posix``. |
| 194 | |
| 195 | .. option:: --print-armap, -M |
| 196 | |
| 197 | Print the archive symbol table, in addition to the symbols. |
| 198 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 199 | .. option:: --print-file-name, -A, -o |
| 200 | |
| 201 | Precede each symbol with the file it came from. |
| 202 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 203 | .. option:: --print-size, -S |
| 204 | |
James Henderson | 2c16bb8 | 2019-06-12 10:44:41 +0000 | [diff] [blame] | 205 | Show symbol size as well as address (not applicable for Mach-O). |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 206 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 207 | .. option:: --radix=<RADIX>, -t |
| 208 | |
| 209 | Specify the radix of the symbol address(es). Values accepted are *d* (decimal), |
| 210 | *x* (hexadecimal) and *o* (octal). |
| 211 | |
| 212 | .. option:: --reverse-sort, -r |
| 213 | |
| 214 | Sort symbols in reverse order. |
| 215 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 216 | .. option:: --size-sort |
| 217 | |
| 218 | Sort symbols by size. |
| 219 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 220 | .. option:: --special-syms |
| 221 | |
| 222 | Ignored. For GNU compatibility only. |
| 223 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 224 | .. option:: --undefined-only, -u |
| 225 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 226 | Print only undefined symbols. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 227 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 228 | .. option:: --version |
Hemant Kulkarni | 5e005a1 | 2016-02-10 17:51:39 +0000 | [diff] [blame] | 229 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 230 | Display the version of this program. Does not stack with other commands. |
| 231 | |
| 232 | .. option:: --without-aliases |
| 233 | |
| 234 | Exclude aliases from the output. |
Hemant Kulkarni | 5e005a1 | 2016-02-10 17:51:39 +0000 | [diff] [blame] | 235 | |
James Henderson | 9485b26 | 2019-06-21 11:49:20 +0000 | [diff] [blame] | 236 | .. option:: @<FILE> |
| 237 | |
| 238 | Read command-line options from response file `<FILE>`. |
| 239 | |
James Henderson | 2c5ff94 | 2019-06-24 10:50:49 +0000 | [diff] [blame] | 240 | MACH-O SPECIFIC OPTIONS |
| 241 | ----------------------- |
| 242 | |
| 243 | .. option:: --add-dyldinfo |
| 244 | |
| 245 | Add symbols from the dyldinfo, if they are not already in the symbol table. |
| 246 | This is the default. |
| 247 | |
| 248 | .. option:: --arch=<arch1[,arch2,...]> |
| 249 | |
| 250 | Dump the symbols from the specified architecture(s). |
| 251 | |
| 252 | .. option:: --dyldinfo-only |
| 253 | |
| 254 | Dump only symbols from the dyldinfo. |
| 255 | |
| 256 | .. option:: --no-dyldinfo |
| 257 | |
| 258 | Do not add any symbols from the dyldinfo. |
| 259 | |
| 260 | .. option:: -s=<segment section> |
| 261 | |
| 262 | Dump only symbols from this segment and section name. |
| 263 | |
| 264 | .. option:: -x |
| 265 | |
| 266 | Print symbol entry in hex. |
| 267 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 268 | BUGS |
| 269 | ---- |
| 270 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 271 | * :program:`llvm-nm` does not support the full set of arguments that GNU |
| 272 | :program:`nm` does. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 273 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 274 | EXIT STATUS |
| 275 | ----------- |
| 276 | |
Michael J. Spencer | 838e5ad | 2012-06-06 23:34:10 +0000 | [diff] [blame] | 277 | :program:`llvm-nm` exits with an exit code of zero. |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 278 | |
Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 279 | SEE ALSO |
| 280 | -------- |
| 281 | |
James Henderson | 92b32a9 | 2019-06-27 15:18:15 +0000 | [diff] [blame] | 282 | :manpage:`llvm-ar(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`, |
| 283 | :manpage:`llvm-readobj(1)` |