blob: b5bd756d5429bf289f5192e40f44bc32286d3ad0 [file] [log] [blame]
Michael J. Spencer838e5ad2012-06-06 23:34:10 +00001llvm-nm - list LLVM bitcode and object file's symbol table
2==========================================================
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00003
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Michael J. Spencer838e5ad2012-06-06 23:34:10 +00007:program:`llvm-nm` [*options*] [*filenames...*]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00008
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00009DESCRIPTION
10-----------
11
Michael J. Spencer838e5ad2012-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 Gribenko8cac8352013-08-18 08:32:32 +000014command line. Each symbol is listed along with some simple information about
James Hendersonbe7f5c72019-06-11 13:46:52 +000015its provenance. If no filename is specified, *a.out* is used as the input.
16If *-* is used as a filename, :program:`llvm-nm` will read a file from its
17standard input stream.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000018
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000019:program:`llvm-nm`'s default output format is the traditional BSD :program:`nm`
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000020output format. Each such output record consists of an (optional) 8-digit
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000021hexadecimal address, followed by a type code character, followed by a name, for
Dmitri Gribenko8cac8352013-08-18 08:32:32 +000022each symbol. One record is printed per line; fields are separated by spaces.
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000023When the address is omitted, it is replaced by 8 spaces.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000024
25Type code characters currently supported, and their meanings, are as follows:
26
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000027U
28
29 Named object is referenced but undefined in this bitcode file
30
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000031C
32
33 Common (multiple definitions link together into one def)
34
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000035W
36
37 Weak reference (multiple definitions link together into zero or one definitions)
38
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000039t
40
41 Local function (text) object
42
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000043T
44
45 Global function (text) object
46
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000047d
48
49 Local data object
50
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000051D
52
53 Global data object
54
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000055?
56
57 Something unrecognizable
58
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000059Because LLVM bitcode files typically contain objects that are not considered to
60have addresses until they are linked into an executable image or dynamically
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000061compiled "just-in-time", :program:`llvm-nm` does not print an address for any
Daniel Dunbar06b9f9e2013-08-16 23:30:19 +000062symbol in an LLVM bitcode file, even symbols which are defined in the bitcode
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000063file.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000064
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000065OPTIONS
66-------
67
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000068.. program:: llvm-nm
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000069
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000070.. option:: -B (default)
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000071
Renato Golin124f2592016-07-20 12:16:38 +000072 Use BSD output format. Alias for `--format=bsd`.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000073
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000074.. option:: -P
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000075
Renato Golin124f2592016-07-20 12:16:38 +000076 Use POSIX.2 output format. Alias for `--format=posix`.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000077
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000078.. option:: --debug-syms, -a
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000079
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000080 Show all symbols, even debugger only.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000081
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000082.. option:: --defined-only
83
84 Print only symbols defined in this file (as opposed to
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000085 symbols which may be referenced by objects in this file, but not
86 defined in this file.)
87
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000088.. option:: --dynamic, -D
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000089
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000090 Display dynamic symbols instead of normal symbols.
91
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000092.. option:: --extern-only, -g
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000093
94 Print only symbols whose definitions are external; that is, accessible
Michael J. Spencer838e5ad2012-06-06 23:34:10 +000095 from other files.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000096
Dave Leed4f77a52018-07-02 17:24:37 +000097.. option:: --no-weak, -W
98
99 Don't print any weak symbols in the output.
100
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000101.. option:: --format=format, -f format
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000102
James Henderson5058ae02019-06-11 15:58:10 +0000103 Select an output format; *format* may be *sysv*, *posix*, *darwin*, or *bsd*.
104 The default is *bsd*.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000105
James Henderson224410b2019-06-11 14:55:31 +0000106.. option:: --help, -h
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000107
108 Print a summary of command-line options and their meanings.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000109
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000110.. option:: --no-sort, -p
111
112 Shows symbols in order encountered.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000113
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000114.. option:: --numeric-sort, -n, -v
115
116 Sort symbols by address.
117
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000118.. option:: --print-file-name, -A, -o
119
120 Precede each symbol with the file it came from.
121
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000122.. option:: --print-size, -S
123
124 Show symbol size instead of address.
125
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000126.. option:: --size-sort
127
128 Sort symbols by size.
129
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000130.. option:: --undefined-only, -u
131
132 Print only symbols referenced but not defined in this file.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000133
Hemant Kulkarni5e005a12016-02-10 17:51:39 +0000134.. option:: --radix=RADIX, -t
135
136 Specify the radix of the symbol address(es). Values accepted d(decimal),
137 x(hexadecomal) and o(octal).
138
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000139BUGS
140----
141
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000142 * :program:`llvm-nm` does not support the full set of arguments that GNU
143 :program:`nm` does.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000144
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000145EXIT STATUS
146-----------
147
Michael J. Spencer838e5ad2012-06-06 23:34:10 +0000148:program:`llvm-nm` exits with an exit code of zero.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000149
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000150SEE ALSO
151--------
152
Dmitri Gribenko8cac8352013-08-18 08:32:32 +0000153llvm-dis, ar(1), nm(1)