blob: 83d9fbaf9e8ccd1cb4f39fbbe8196b69b4a33602 [file] [log] [blame]
Michael J. Spencer4d616642012-06-06 23:34:10 +00001llvm-nm - list LLVM bitcode and object file's symbol table
2==========================================================
Daniel Dunbar3b709d52012-05-08 16:50:35 +00003
Daniel Dunbar3b709d52012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Michael J. Spencer4d616642012-06-06 23:34:10 +00007:program:`llvm-nm` [*options*] [*filenames...*]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00008
Daniel Dunbar3b709d52012-05-08 16:50:35 +00009DESCRIPTION
10-----------
11
Michael J. Spencer4d616642012-06-06 23:34:10 +000012The :program:`llvm-nm` utility lists the names of symbols from the LLVM bitcode
13files, object files, or :program:`ar` archives containing them, named on the
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000014command line. Each symbol is listed along with some simple information about
15its provenance. If no file name is specified, or *-* is used as a file name,
Michael J. Spencer4d616642012-06-06 23:34:10 +000016:program:`llvm-nm` will process a file on its standard input stream.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000017
Michael J. Spencer4d616642012-06-06 23:34:10 +000018:program:`llvm-nm`'s default output format is the traditional BSD :program:`nm`
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000019output format. Each such output record consists of an (optional) 8-digit
Michael J. Spencer4d616642012-06-06 23:34:10 +000020hexadecimal address, followed by a type code character, followed by a name, for
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000021each symbol. One record is printed per line; fields are separated by spaces.
Michael J. Spencer4d616642012-06-06 23:34:10 +000022When the address is omitted, it is replaced by 8 spaces.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000023
24Type code characters currently supported, and their meanings, are as follows:
25
Daniel Dunbar3b709d52012-05-08 16:50:35 +000026U
27
28 Named object is referenced but undefined in this bitcode file
29
Daniel Dunbar3b709d52012-05-08 16:50:35 +000030C
31
32 Common (multiple definitions link together into one def)
33
Daniel Dunbar3b709d52012-05-08 16:50:35 +000034W
35
36 Weak reference (multiple definitions link together into zero or one definitions)
37
Daniel Dunbar3b709d52012-05-08 16:50:35 +000038t
39
40 Local function (text) object
41
Daniel Dunbar3b709d52012-05-08 16:50:35 +000042T
43
44 Global function (text) object
45
Daniel Dunbar3b709d52012-05-08 16:50:35 +000046d
47
48 Local data object
49
Daniel Dunbar3b709d52012-05-08 16:50:35 +000050D
51
52 Global data object
53
Daniel Dunbar3b709d52012-05-08 16:50:35 +000054?
55
56 Something unrecognizable
57
Daniel Dunbar3b709d52012-05-08 16:50:35 +000058Because LLVM bitcode files typically contain objects that are not considered to
59have addresses until they are linked into an executable image or dynamically
Michael J. Spencer4d616642012-06-06 23:34:10 +000060compiled "just-in-time", :program:`llvm-nm` does not print an address for any
Daniel Dunbar13230062013-08-16 23:30:19 +000061symbol in an LLVM bitcode file, even symbols which are defined in the bitcode
Michael J. Spencer4d616642012-06-06 23:34:10 +000062file.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000063
Daniel Dunbar3b709d52012-05-08 16:50:35 +000064OPTIONS
65-------
66
Michael J. Spencer4d616642012-06-06 23:34:10 +000067.. program:: llvm-nm
Daniel Dunbar3b709d52012-05-08 16:50:35 +000068
Michael J. Spencer4d616642012-06-06 23:34:10 +000069.. option:: -B (default)
Daniel Dunbar3b709d52012-05-08 16:50:35 +000070
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000071 Use BSD output format. Alias for :option:`--format=bsd`.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000072
Michael J. Spencer4d616642012-06-06 23:34:10 +000073.. option:: -P
Daniel Dunbar3b709d52012-05-08 16:50:35 +000074
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000075 Use POSIX.2 output format. Alias for :option:`--format=posix`.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000076
Michael J. Spencer4d616642012-06-06 23:34:10 +000077.. option:: --debug-syms, -a
Daniel Dunbar3b709d52012-05-08 16:50:35 +000078
Michael J. Spencer4d616642012-06-06 23:34:10 +000079 Show all symbols, even debugger only.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000080
Michael J. Spencer4d616642012-06-06 23:34:10 +000081.. option:: --defined-only
82
83 Print only symbols defined in this file (as opposed to
Daniel Dunbar3b709d52012-05-08 16:50:35 +000084 symbols which may be referenced by objects in this file, but not
85 defined in this file.)
86
Michael J. Spencer4d616642012-06-06 23:34:10 +000087.. option:: --dynamic, -D
Daniel Dunbar3b709d52012-05-08 16:50:35 +000088
Michael J. Spencer4d616642012-06-06 23:34:10 +000089 Display dynamic symbols instead of normal symbols.
90
Michael J. Spencer4d616642012-06-06 23:34:10 +000091.. option:: --extern-only, -g
Daniel Dunbar3b709d52012-05-08 16:50:35 +000092
93 Print only symbols whose definitions are external; that is, accessible
Michael J. Spencer4d616642012-06-06 23:34:10 +000094 from other files.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000095
Michael J. Spencer4d616642012-06-06 23:34:10 +000096.. option:: --format=format, -f format
Daniel Dunbar3b709d52012-05-08 16:50:35 +000097
Dmitri Gribenko70f6b362013-08-18 08:32:32 +000098 Select an output format; *format* may be *sysv*, *posix*, or *bsd*. The default
Michael J. Spencer4d616642012-06-06 23:34:10 +000099 is *bsd*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000100
Michael J. Spencer4d616642012-06-06 23:34:10 +0000101.. option:: -help
102
103 Print a summary of command-line options and their meanings.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000104
Michael J. Spencer4d616642012-06-06 23:34:10 +0000105.. option:: --no-sort, -p
106
107 Shows symbols in order encountered.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000108
Michael J. Spencer4d616642012-06-06 23:34:10 +0000109.. option:: --numeric-sort, -n, -v
110
111 Sort symbols by address.
112
Michael J. Spencer4d616642012-06-06 23:34:10 +0000113.. option:: --print-file-name, -A, -o
114
115 Precede each symbol with the file it came from.
116
Michael J. Spencer4d616642012-06-06 23:34:10 +0000117.. option:: --print-size, -S
118
119 Show symbol size instead of address.
120
Michael J. Spencer4d616642012-06-06 23:34:10 +0000121.. option:: --size-sort
122
123 Sort symbols by size.
124
Michael J. Spencer4d616642012-06-06 23:34:10 +0000125.. option:: --undefined-only, -u
126
127 Print only symbols referenced but not defined in this file.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000128
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000129BUGS
130----
131
Michael J. Spencer4d616642012-06-06 23:34:10 +0000132 * :program:`llvm-nm` cannot demangle C++ mangled names, like GNU :program:`nm`
133 can.
134
135 * :program:`llvm-nm` does not support the full set of arguments that GNU
136 :program:`nm` does.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000137
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000138EXIT STATUS
139-----------
140
Michael J. Spencer4d616642012-06-06 23:34:10 +0000141:program:`llvm-nm` exits with an exit code of zero.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000142
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000143SEE ALSO
144--------
145
Dmitri Gribenko70f6b362013-08-18 08:32:32 +0000146llvm-dis, ar(1), nm(1)