1LLVM-SIZE(1) LLVM LLVM-SIZE(1)
2
3
4
6 llvm-size - print size information
7
9 llvm-size [options] [input...]
10
12 llvm-size is a tool that prints size information for binary files. It
13 is intended to be a drop-in replacement for GNU's size.
14
15 The tool prints size information for each input specified. If no input
16 is specified, the program prints size information for a.out. If "-" is
17 specified as an input file, llvm-size reads a file from the standard
18 input stream. If an input is an archive, size information will be dis‐
19 played for all its members.
20
22 -A Equivalent to --format with a value of sysv.
23
24 --arch=<arch>
25 Architecture(s) from Mach-O universal binaries to display infor‐
26 mation for.
27
28 -B Equivalent to --format with a value of berkeley.
29
30 --common
31 Include ELF common symbol sizes in bss size for berkeley output
32 format, or as a separate section entry for sysv output. If not
33 specified, these symbols are ignored.
34
35 -d Equivalent to --radix with a value of 10.
36
37 -l Display verbose address and offset information for segments and
38 sections in Mach-O files in darwin format.
39
40 --format=<format>
41 Set the output format to the <format> specified. Available <for‐
42 mat> options are berkeley (the default), sysv and darwin.
43
44 Berkeley output summarises text, data and bss sizes in each
45 file, as shown below for a typical pair of ELF files:
46
47 $ llvm-size --format=berkeley test.o test2.o
48 text data bss dec hex filename
49 182 16 5 203 cb test.elf
50 82 8 1 91 5b test2.o
51
52 For Mach-O files, the output format is slightly different:
53
54 $ llvm-size --format=berkeley macho.obj macho2.obj
55 __TEXT __DATA __OBJC others dec hex
56 4 8 0 0 12 c macho.obj
57 16 32 0 0 48 30 macho2.obj
58
59 Sysv output displays size and address information for most sec‐
60 tions, with each file being listed separately:
61
62 $ llvm-size --format=sysv test.elf test2.o
63 test.elf :
64 section size addr
65 .eh_frame 92 2097496
66 .text 90 2101248
67 .data 16 2105344
68 .bss 5 2105360
69 .comment 209 0
70 Total 412
71
72 test2.o :
73 section size addr
74 .text 26 0
75 .data 8 0
76 .bss 1 0
77 .comment 106 0
78 .note.GNU-stack 0 0
79 .eh_frame 56 0
80 .llvm_addrsig 2 0
81 Total 199
82
83 darwin format only affects Mach-O input files. If an input of a
84 different file format is specified, llvm-size falls back to
85 berkeley format. When producing darwin format, the tool displays
86 information about segments and sections:
87
88 $ llvm-size --format=darwin macho.obj macho2.obj
89 macho.obj:
90 Segment : 12
91 Section (__TEXT, __text): 4
92 Section (__DATA, __data): 8
93 total 12
94 total 12
95 macho2.obj:
96 Segment : 48
97 Section (__TEXT, __text): 16
98 Section (__DATA, __data): 32
99 total 48
100 total 48
101
102 --help, -h
103 Display a summary of command line options.
104
105 -m Equivalent to --format with a value of darwin.
106
107 -o Equivalent to --radix with a value of 8.
108
109 --radix=<value>
110 Display size information in the specified radix. Permitted val‐
111 ues are 8, 10 (the default) and 16 for octal, decimal and hexa‐
112 decimal output respectively.
113
114 Example:
115
116 $ llvm-size --radix=8 test.o
117 text data bss oct hex filename
118 0152 04 04 162 72 test.o
119
120 $ llvm-size --radix=10 test.o
121 text data bss dec hex filename
122 106 4 4 114 72 test.o
123
124 $ llvm-size --radix=16 test.o
125 text data bss dec hex filename
126 0x6a 0x4 0x4 114 72 test.o
127
128 --totals, -t
129 Applies only to berkeley output format. Display the totals for
130 all listed fields, in addition to the individual file listings.
131
132 Example:
133
134 $ llvm-size --totals test.elf test2.o
135 text data bss dec hex filename
136 182 16 5 203 cb test.elf
137 82 8 1 91 5b test2.o
138 264 24 6 294 126 (TOTALS)
139
140 --version
141 Display the version of the llvm-size executable.
142
143 -x Equivalent to --radix with a value of 16.
144
145 @<FILE>
146 Read command-line options from response file <FILE>.
147
149 llvm-size exits with a non-zero exit code if there is an error. Other‐
150 wise, it exits with code 0.
151
153 To report bugs, please visit <https://bugs.llvm.org/>.
154
156 Maintained by the LLVM Team (https://llvm.org/).
157
159 2003-2022, LLVM Project
160
161
162
163
16413 2022-07-21 LLVM-SIZE(1)