]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/elftoolchain/size/size.1
MFHead @348740
[FreeBSD/FreeBSD.git] / contrib / elftoolchain / size / size.1
1 .\" Copyright (c) 2007 S.Sam Arun Raj
2 .\" Copyright (c) 2008,2011 Joseph Koshy
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $Id: size.1 3195 2015-05-12 17:22:19Z emaste $
27 .\"
28 .Dd August 25, 2011
29 .Dt SIZE 1
30 .Os
31 .Sh NAME
32 .Nm size
33 .Nd "display section sizes and total size of ELF objects"
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl -format= Ns Ar format
37 .Op Fl -help
38 .Op Fl -radix= Ns Ar radix
39 .Op Fl -totals
40 .Op Fl -version
41 .Op Fl ABVdhotx
42 .Op Ar
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility
47 lists the sizes of ELF sections, and optionally the total size, for
48 each input
49 .Ar file
50 specified on the command line.
51 The
52 .Nm
53 utility can operate on ELF objects, on
54 .Xr ar 1
55 archives containing ELF objects, and on core dumps.
56 If no file name is specified on the command-line,
57 .Pa a.out
58 is assumed.
59 .Pp
60 The
61 .Nm
62 utility recognized the following options:
63 .Bl -tag -width indent
64 .It Fl -format= Ns Ar format
65 Display output using the format specified by argument
66 .Ar format .
67 Supported values for this argument are:
68 .Sq berkeley
69 and
70 .Sq sysv .
71 The default output format is
72 .Sq berkeley .
73 See
74 .Sx Display Formats
75 below for more information.
76 .It Fl -help
77 Display a help message and exit.
78 .It Fl -radix= Ns Ar radix
79 Display numeric values using the radix specified by argument
80 .Ar radix .
81 Supported values for
82 .Ar radix
83 are 8, 10 and 16.
84 The default radix is 10.
85 .It Fl -totals
86 Shows cumulative totals of section sizes from all objects.
87 This option is ignored for System V style output.
88 .It Fl -version
89 Display a version identifier and exit.
90 .It Fl A
91 Equivalent to specifying option
92 .Fl -format= Ns Ar sysv .
93 .It Fl B
94 Equivalent to specifying option
95 .Fl -format= Ns Ar berkeley .
96 .It Fl V
97 Equivalent to specifying option
98 .Fl -version .
99 .It Fl d
100 Equivalent to specifying option
101 .Fl -radix= Ns Ar 10 .
102 .It Fl h
103 Equivalent to specifying option
104 .Fl -help .
105 .It Fl o
106 Equivalent to specifying option
107 .Fl -radix= Ns Ar 8 .
108 .It Fl t
109 Equivalent to specifying option
110 .Fl -totals .
111 .It Fl x
112 Equivalent to specifying option
113 .Fl -radix= Ns Ar 16 .
114 .El
115 .Sh DISPLAY FORMATS
116 .Ss Berkeley Style Output
117 If
118 .Sq berkeley
119 style output is in effect, an initial header line naming fields will
120 be output, followed by one line of output for each ELF object specified
121 on the command line or found in an archive.
122 .Pp
123 Each line will contain the following whitespace separated fields
124 in order:
125 .Bl -enum -compact
126 .It
127 The size of the text segment in the object.
128 .It
129 The size of the data segment in the object.
130 .It
131 The size of the
132 .Sq bss
133 segment in the object.
134 .It
135 The total size of the object in either decimal or octal.
136 Decimal output is used if the specified output radix for numeric values
137 is 10 or 16.
138 Octal output is used if the radix being used for numeric values
139 is 8.
140 .It
141 The total size of the object in hexadecimal.
142 .It
143 The file name of the object.
144 .El
145 .Pp
146 If option
147 .Fl -totals
148 was specified, an additional line in the same format as above will be
149 output at the end containing the sum of the respective fields.
150 The file name field for the line will contain the string
151 .Sq (TOTALS) .
152 .Ss System V Style Output
153 If System V style output is selected,
154 .Nm
155 will output the following information for each object:
156 .Bl -enum -compact
157 .It
158 The name of the object followed by a colon.
159 .It
160 A header line containing the names of fields of subsequent lines.
161 .It
162 One line per section present in the object.
163 Each line has three fields:
164 .Bl -enum -compact
165 .It
166 The name of the section.
167 .It
168 Its size, in the selected radix for numeric values.
169 .It
170 The address associated with the section, in the selected numeric radix.
171 .El
172 .It
173 A line whose section name field contains the string
174 .Sq Total
175 and whose size field contains the sum of all reported section sizes.
176 .El
177 .Sh EXIT STATUS
178 .Ex -std
179 .Sh EXAMPLES
180 To display the section sizes for
181 .Pa /bin/ls
182 use:
183 .Bd -literal
184 $ size /bin/ls
185 text       data       bss        dec        hex        filename
186 20975      540        392        21907      5593        /bin/ls
187 .Ed
188 .Pp
189 To display sizes and total for
190 .Pa /bin/ls
191 and
192 .Pa /bin/dd
193 in hexadecimal, use:
194 .Bd -literal
195 $ size -tx /bin/ls /bin/dd
196 text       data       bss        dec        hex        filename
197 0x51ef     0x21c      0x188      21907      5593        /bin/ls
198 0x3df5     0x170      0x200      16741      4165        /bin/dd
199 0x8fe4     0x38c      0x388      38648      96f8       (TOTALS)
200 .Ed
201 .Pp
202 To display section sizes for
203 .Pa /bin/ls
204 in System V format use:
205 .Bd -literal
206 $ size -A /bin/ls
207 /bin/ls  :
208 section            size       addr
209 \&.interp            21         4194704
210 \&.note.ABI-tag      24         4194728
211 \&.hash              624        4194752
212 \&.dynsym            2088       4195376
213 \&.dynstr            810        4197464
214 \&.rela.dyn          120        4198280
215 \&.rela.plt          1656       4198400
216 \&.init              19         4200056
217 \&.plt               1120       4200076
218 \&.text              15224      4201200
219 \&.fini              14         4216424
220 \&.rodata            1472       4216448
221 \&.data              80         5267456
222 \&.eh_frame          1624       5267536
223 \&.dynamic           384        5269160
224 \&.ctors             16         5269544
225 \&.dtors             16         5269560
226 \&.jcr               8          5269576
227 \&.got               576        5269584
228 \&.bss               528        5270176
229 \&.comment           686        0
230 Total              27110
231 .Ed
232 .Sh SEE ALSO
233 .Xr ar 1 ,
234 .Xr nm 1 ,
235 .Xr objdump 1 ,
236 .Xr readelf 1 ,
237 .Xr strings 1 ,
238 .Xr elf 3 ,
239 .Xr gelf 3
240 .Rs
241 .%A "AT&T Unix Systems Labs"
242 .%T "System V Application Binary Interface"
243 .%O http://www.sco.com/developers/gabi/
244 .Re
245 .Sh HISTORY
246 The
247 .Nm
248 utility first appeared in
249 .At v6 .
250 .Sh AUTHORS
251 .An -nosplit
252 The
253 .Nm
254 utility was re-written by
255 .An S. Sam Arun Raj Aq Mt samarunraj@gmail.com
256 This manual page was written by
257 .An S. Sam Arun Raj Aq Mt samarunraj@gmail.com