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 --help-list
106 Display an uncategorized summary of command line options.
107
108 -m Equivalent to --format with a value of darwin.
109
110 -o Equivalent to --radix with a value of 8.
111
112 --radix=<value>
113 Display size information in the specified radix. Permitted val‐
114 ues are 8, 10 (the default) and 16 for octal, decimal and hexa‐
115 decimal output respectively.
116
117 Example:
118
119 $ llvm-size --radix=8 test.o
120 text data bss oct hex filename
121 0152 04 04 162 72 test.o
122
123 $ llvm-size --radix=10 test.o
124 text data bss dec hex filename
125 106 4 4 114 72 test.o
126
127 $ llvm-size --radix=16 test.o
128 text data bss dec hex filename
129 0x6a 0x4 0x4 114 72 test.o
130
131 --totals, -t
132 Applies only to berkeley output format. Display the totals for
133 all listed fields, in addition to the individual file listings.
134
135 Example:
136
137 $ llvm-size --totals test.elf test2.o
138 text data bss dec hex filename
139 182 16 5 203 cb test.elf
140 82 8 1 91 5b test2.o
141 264 24 6 294 126 (TOTALS)
142
143 --version
144 Display the version of the llvm-size executable.
145
146 -x Equivalent to --radix with a value of 16.
147
148 @<FILE>
149 Read command-line options from response file <FILE>.
150
152 llvm-size exits with a non-zero exit code if there is an error. Other‐
153 wise, it exits with code 0.
154
156 To report bugs, please visit <https://bugs.llvm.org/>.
157
159 Maintained by the LLVM Team (https://llvm.org/).
160
162 2003-2021, LLVM Project
163
164
165
166
16711 2021-03-23 LLVM-SIZE(1)