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