size1
Print size information
Part of llvm-size(1).
Usage
llvm-size [options]
[input ...]
Overview
llvm-size is a tool that prints size information for binary files. It is intended to be a drop-in replacement for GNU's size.
The tool prints size information for each input specified. If no input is specified, the program prints size information for a.out. If "-" is specified as an input file, llvm-size reads a file from the standard input stream. If an input is an archive, size information will be displayed for all its members.
Options
-
-A -
Equivalent to --format with a value of
sysv.
-
--arch=<arch> -
Architecture(s) from Mach-O universal binaries to display information for.
-
-B -
Equivalent to --format with a value of
berkeley.
-
--common -
Include ELF common symbol sizes in bss size for
berkeleyoutput format, or as a separate section entry forsysvoutput. If not specified, these symbols are ignored.
-
-d -
Equivalent to --radix with a value of
10.
-
-l -
Display verbose address and offset information for segments and sections in Mach-O files in
darwinformat.
-
--format=<format> -
Set the output format to the
<format>specified. Available<format>options areberkeley(the default),sysvanddarwin.Berkeley output summarises text, data and bss sizes in each file, as shown below for a typical pair of ELF files:
$ llvm-size --format=berkeley test.o test2.otext data bss dec hex filename182 16 5 203 cb test.elf82 8 1 91 5b test2.oFor Mach-O files, the output format is slightly different:
$ llvm-size --format=berkeley macho.obj macho2.obj__TEXT __DATA __OBJC others dec hex4 8 0 0 12 c macho.obj16 32 0 0 48 30 macho2.objSysv output displays size and address information for most sections, with each file being listed separately:
$ llvm-size --format=sysv test.elf test2.otest.elf :section size addr.eh_frame 92 2097496.text 90 2101248.data 16 2105344.bss 5 2105360.comment 209 0Total 412test2.o :section size addr.text 26 0.data 8 0.bss 1 0.comment 106 0.note.GNU-stack 0 0.eh_frame 56 0.llvm_addrsig 2 0Total 199darwinformat only affects Mach-O input files. If an input of a different file format is specified,llvm-sizefalls back toberkeleyformat. When producingdarwinformat, the tool displays information about segments and sections:$ llvm-size --format=darwin macho.obj macho2.objmacho.obj:Segment : 12Section (__TEXT, __text): 4Section (__DATA, __data): 8total 12total 12macho2.obj:Segment : 48Section (__TEXT, __text): 16Section (__DATA, __data): 32total 48total 48
-
--help, -h -
Display a summary of command line options.
-
-m -
Equivalent to --format with a value of
darwin.
-
-o -
Equivalent to --radix with a value of
8.
-
--radix=<value> -
Display size information in the specified radix. Permitted values are
8,10(the default) and16for octal, decimal and hexadecimal output respectively.Example:
$ llvm-size --radix=8 test.otext data bss oct hex filename0152 04 04 162 72 test.o$ llvm-size --radix=10 test.otext data bss dec hex filename106 4 4 114 72 test.o$ llvm-size --radix=16 test.otext data bss dec hex filename0x6a 0x4 0x4 114 72 test.o
-
--totals, -t -
Applies only to
berkeleyoutput format. Display the totals for all listed fields, in addition to the individual file listings.Example:
$ llvm-size --totals test.elf test2.otext data bss dec hex filename182 16 5 203 cb test.elf82 8 1 91 5b test2.o264 24 6 294 126 (TOTALS)
-
--version -
Display the version of the
llvm-sizeexecutable.
-
-x -
Equivalent to --radix with a value of
16.
- @<FILE>
-
Read command-line options from response file <FILE>.
Exit status
llvm-size exits with a non-zero exit code if there is an error. Otherwise, it exits with code 0.
Releases
87 releases since FreeBSD 2.0.5-RELEASE; the text changed 17 times.
- 2.0.5–2.1.7.1
- 2.2.2
- 2.2.5–2.2.9
- 3.0–4.3
- 4.4–4.11
- 5.0–5.2.1
- 5.3–8.4
- 9.0
- 9.1
- 9.2
- 9.3
- 10.0
- 10.1
- 10.2
- 10.3
- 10.4
- 11.0–14.5
- 15.0–16.0
--arch since FreeBSD 15.0-RELEASE;
--common since FreeBSD 15.0-RELEASE;
--format since FreeBSD 3.0-RELEASE;
--help since FreeBSD 3.0-RELEASE;
--radix since FreeBSD 3.0-RELEASE;
--totals since FreeBSD 5.0-RELEASE;
--version since FreeBSD 3.0-RELEASE;
-A since FreeBSD 3.0-RELEASE;
-B since FreeBSD 3.0-RELEASE;
-d since FreeBSD 3.0-RELEASE;
-h since FreeBSD 11.0-RELEASE;
-l since FreeBSD 15.0-RELEASE;
-m since FreeBSD 15.0-RELEASE;
-o since FreeBSD 3.0-RELEASE;
-t since FreeBSD 5.0-RELEASE;
-x since FreeBSD 3.0-RELEASE.
--target until FreeBSD 10.4-RELEASE;
-V until FreeBSD 14.5-RELEASE.