llvm.org GIT mirror llvm / bc9f059
[docs][llvm-size] Write llvm-size documentation Previously we only had a stub document. Reviewed by: serge-sans-paille, MaskRay Differential Revision: https://reviews.llvm.org/D67555 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371983 91177308-0d34-0410-b5e6-96231b3b80d8 James Henderson a month ago
1 changed file(s) with 186 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
55 SYNOPSIS
66 --------
77
8 :program:`llvm-size` [*options*]
8 :program:`llvm-size` [*options*] [*input...*]
99
1010 DESCRIPTION
1111 -----------
1212
13 :program:`llvm-size` is a tool that prints size information for object files.
14 The goal is to make it a drop-in replacement for GNU's :program:`size`.
13 :program:`llvm-size` is a tool that prints size information for binary files.
14 It is intended to be a drop-in replacement for GNU's :program:`size`.
15
16 The tool prints size information for each ``input`` specified. If no input is
17 specified, the program prints size information for ``a.out``. If "``-``" is
18 specified as an input file, :program:`llvm-size` reads a file from the standard
19 input stream. If an input is an archive, size information will be displayed for
20 all its members.
21
22 OPTIONS
23 -------
24
25 .. option:: -A
26
27 Equivalent to :option:`--format` with a value of ``sysv``.
28
29 .. option:: --arch=
30
31 Architecture(s) from Mach-O universal binaries to display information for.
32
33 .. option:: -B
34
35 Equivalent to :option:`--format` with a value of ``berkeley``.
36
37 .. option:: --common
38
39 Include ELF common symbol sizes in bss size for ``berkeley`` output format, or
40 as a separate section entry for ``sysv`` output. If not specified, these
41 symbols are not ignored.
42
43 .. option:: -d
44
45 Equivalent to :option:`--radix` with a value of ``10``.
46
47 .. option:: -l
48
49 Display verbose address and offset information for segments and sections in
50 Mach-O files in ``darwin`` format.
51
52 .. option:: --format=
53
54 Set the output format to the ```` specified. Available ````
55 options are ``berkeley`` (the default), ``sysv`` and ``darwin``.
56
57 Berkeley output summarises text, data and bss sizes in each file, as shown
58 below for a typical pair of ELF files:
59
60 .. code-block:: console
61
62 $ llvm-size --format=berkeley test.o test2.o
63 text data bss dec hex filename
64 182 16 5 203 cb test.elf
65 82 8 1 91 5b test2.o
66
67 For Mach-O files, the output format is slightly different:
68
69 .. code-block:: console
70
71 $ llvm-size --format=berkeley macho.obj macho2.obj
72 __TEXT __DATA __OBJC others dec hex
73 4 8 0 0 12 c macho.obj
74 16 32 0 0 48 30 macho2.obj
75
76 Sysv output displays size and address information for most sections, with each
77 file being listed separately:
78
79 .. code-block:: console
80
81 $ llvm-size --format=sysv test.elf test2.o
82 test.elf :
83 section size addr
84 .eh_frame 92 2097496
85 .text 90 2101248
86 .data 16 2105344
87 .bss 5 2105360
88 .comment 209 0
89 Total 412
90
91 test2.o :
92 section size addr
93 .text 26 0
94 .data 8 0
95 .bss 1 0
96 .comment 106 0
97 .note.GNU-stack 0 0
98 .eh_frame 56 0
99 .llvm_addrsig 2 0
100 Total 199
101
102 ``darwin`` format only affects Mach-O input files. If an input of a different
103 file format is specified, :program:`llvm-size` falls back to ``berkeley``
104 format. When producing ``darwin`` format, the tool displays information about
105 segments and sections:
106
107 .. code-block:: console
108
109 $ llvm-size --format=darwin macho.obj macho2.obj
110 macho.obj:
111 Segment : 12
112 Section (__TEXT, __text): 4
113 Section (__DATA, __data): 8
114 total 12
115 total 12
116 macho2.obj:
117 Segment : 48
118 Section (__TEXT, __text): 16
119 Section (__DATA, __data): 32
120 total 48
121 total 48
122
123 .. option:: --help, -h
124
125 Display a summary of command line options.
126
127 .. option:: --help-list
128
129 Display an uncategorized summary of command line options.
130
131 .. option:: -m
132
133 Equivalent to :option:`--format` with a value of ``darwin``.
134
135 .. option:: -o
136
137 Equivalent to :option:`--radix` with a value of ``8``.
138
139 .. option:: --radix=
140
141 Display size information in the specified radix. Permitted values are ``8``,
142 ``10`` (the default) and ``16`` for octal, decimal and hexadecimal output
143 respectively.
144
145 Example:
146
147 .. code-block:: console
148
149 $ llvm-size --radix=8 test.o
150 text data bss oct hex filename
151 0152 04 04 162 72 test.o
152
153 $ llvm-size --radix=10 test.o
154 text data bss dec hex filename
155 106 4 4 114 72 test.o
156
157 $ llvm-size --radix=16 test.o
158 text data bss dec hex filename
159 0x6a 0x4 0x4 114 72 test.o
160
161 .. option:: --totals, -t
162
163 Applies only to ``berkeley`` output format. Display the totals for all listed
164 fields, in addition to the individual file listings.
165
166 Example:
167
168 .. code-block:: console
169
170 $ llvm-size --totals test.elf test2.o
171 text data bss dec hex filename
172 182 16 5 203 cb test.elf
173 82 8 1 91 5b test2.o
174 264 24 6 294 126 (TOTALS)
175
176 .. option:: --version
177
178 Display the version of the :program:`llvm-size` executable.
179
180 .. option:: -x
181
182 Equivalent to :option:`--radix` with a value of ``16``.
183
184 .. option:: @
185
186 Read command-line options from response file ````.
187
188 EXIT STATUS
189 -----------
190
191 :program:`llvm-size` exits with a non-zero exit code if there is an error.
192 Otherwise, it exits with code 0.
193
194 BUGS
195 ----
196
197 To report bugs, please visit .