1 llvm-size - print size information
2 ==================================
9 :program:`llvm-size` [*options*] [*input...*]
14 :program:`llvm-size` is a tool that prints size information for binary files.
15 It is intended to be a drop-in replacement for GNU's :program:`size`.
17 The tool prints size information for each ``input`` specified. If no input is
18 specified, the program prints size information for ``a.out``. If "``-``" is
19 specified as an input file, :program:`llvm-size` reads a file from the standard
20 input stream. If an input is an archive, size information will be displayed for
28 Equivalent to :option:`--format` with a value of ``sysv``.
30 .. option:: --arch=<arch>
32 Architecture(s) from Mach-O universal binaries to display information for.
36 Equivalent to :option:`--format` with a value of ``berkeley``.
40 Include ELF common symbol sizes in bss size for ``berkeley`` output format, or
41 as a separate section entry for ``sysv`` output. If not specified, these
42 symbols are not ignored.
46 Equivalent to :option:`--radix` with a value of ``10``.
50 Display verbose address and offset information for segments and sections in
51 Mach-O files in ``darwin`` format.
53 .. option:: --format=<format>
55 Set the output format to the ``<format>`` specified. Available ``<format>``
56 options are ``berkeley`` (the default), ``sysv`` and ``darwin``.
58 Berkeley output summarises text, data and bss sizes in each file, as shown
59 below for a typical pair of ELF files:
61 .. code-block:: console
63 $ llvm-size --format=berkeley test.o test2.o
64 text data bss dec hex filename
65 182 16 5 203 cb test.elf
68 For Mach-O files, the output format is slightly different:
70 .. code-block:: console
72 $ llvm-size --format=berkeley macho.obj macho2.obj
73 __TEXT __DATA __OBJC others dec hex
74 4 8 0 0 12 c macho.obj
75 16 32 0 0 48 30 macho2.obj
77 Sysv output displays size and address information for most sections, with each
78 file being listed separately:
80 .. code-block:: console
82 $ llvm-size --format=sysv test.elf test2.o
103 ``darwin`` format only affects Mach-O input files. If an input of a different
104 file format is specified, :program:`llvm-size` falls back to ``berkeley``
105 format. When producing ``darwin`` format, the tool displays information about
106 segments and sections:
108 .. code-block:: console
110 $ llvm-size --format=darwin macho.obj macho2.obj
113 Section (__TEXT, __text): 4
114 Section (__DATA, __data): 8
119 Section (__TEXT, __text): 16
120 Section (__DATA, __data): 32
124 .. option:: --help, -h
126 Display a summary of command line options.
128 .. option:: --help-list
130 Display an uncategorized summary of command line options.
134 Equivalent to :option:`--format` with a value of ``darwin``.
138 Equivalent to :option:`--radix` with a value of ``8``.
140 .. option:: --radix=<value>
142 Display size information in the specified radix. Permitted values are ``8``,
143 ``10`` (the default) and ``16`` for octal, decimal and hexadecimal output
148 .. code-block:: console
150 $ llvm-size --radix=8 test.o
151 text data bss oct hex filename
152 0152 04 04 162 72 test.o
154 $ llvm-size --radix=10 test.o
155 text data bss dec hex filename
156 106 4 4 114 72 test.o
158 $ llvm-size --radix=16 test.o
159 text data bss dec hex filename
160 0x6a 0x4 0x4 114 72 test.o
162 .. option:: --totals, -t
164 Applies only to ``berkeley`` output format. Display the totals for all listed
165 fields, in addition to the individual file listings.
169 .. code-block:: console
171 $ llvm-size --totals test.elf test2.o
172 text data bss dec hex filename
173 182 16 5 203 cb test.elf
175 264 24 6 294 126 (TOTALS)
177 .. option:: --version
179 Display the version of the :program:`llvm-size` executable.
183 Equivalent to :option:`--radix` with a value of ``16``.
187 Read command-line options from response file ``<FILE>``.
192 :program:`llvm-size` exits with a non-zero exit code if there is an error.
193 Otherwise, it exits with code 0.
198 To report bugs, please visit <http://llvm.org/bugs/>.