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