Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man1 / size.1
blobce414e402dfd462535ecd5e146abb8ef80d8ba09
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 2009, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SIZE 1 "Aug 24, 2009"
7 .SH NAME
8 size \- print section sizes in bytes of object files
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBsize\fR [\fB-f\fR] [\fB-F\fR] [\fB-n\fR] [\fB-o\fR] [\fB-V\fR] [\fB-x\fR] \fIfilename\fR...
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 The \fBsize\fR command produces segment or section size information in bytes
19 for each loaded section in ELF object files. \fBsize\fR prints out  the size of
20 the text, data, and bss (uninitialized data) segments (or  sections) and their
21 total.
22 .sp
23 .LP
24 \fBsize\fR processes ELF object files entered on the command line. If an
25 archive file is input to the \fBsize\fR command, the information for each
26 object file in the archive is displayed.
27 .sp
28 .LP
29 When calculating segment information, the \fBsize\fR command prints out the
30 total file size of the non-writable segments, the total file size of the
31 writable segments, and the total memory size of the writable segments minus the
32 total  file size of the writable segments.
33 .sp
34 .LP
35 If it cannot calculate segment information, \fBsize\fR calculates section
36 information. When calculating section  information, it prints out the total
37 size of sections that are allocatable,  non-writable, and not \fBNOBITS\fR, the
38 total size of the sections that are allocatable,  writable, and not
39 \fBNOBITS\fR, and the total size of the writable sections of type \fBNOBITS\fR.
40 \fBNOBITS\fR sections do not actually take up space in the \fIfilename\fR.
41 .sp
42 .LP
43 If \fBsize\fR cannot calculate either segment or section information, it
44 prints an error message and stops processing the file.
45 .SH OPTIONS
46 .sp
47 .LP
48 The following options are supported:
49 .sp
50 .ne 2
51 .na
52 \fB\fB-f\fR\fR
53 .ad
54 .RS 6n
55 Prints out the size of each allocatable section, the name of the section, and
56 the total of the section sizes. If there is no section data, \fBsize\fR prints
57 out an error message and stops processing the file.
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fB-F\fR\fR
64 .ad
65 .RS 6n
66 Prints out the size of each loadable segment, the permission  flags of the
67 segment, then the total of the loadable segment sizes. If there is no segment
68 data, \fBsize\fR prints an error message and stops processing the file.
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fB\fB-n\fR\fR
75 .ad
76 .RS 6n
77 Prints out non-loadable segment or non-allocatable section sizes. If segment
78 data exists, \fBsize\fR prints out the memory size of each loadable segment or
79 file size of each non-loadable segment, the permission flags, and the total
80 size of the segments. If there is no segment data, \fBsize\fR prints out, for
81 each allocatable and non-allocatable section, the memory size, the section
82 name,  and the total size of the sections. If there is no segment or section
83 data, \fBsize\fR prints an error message and stops processing.
84 .RE
86 .sp
87 .ne 2
88 .na
89 \fB\fB-o\fR\fR
90 .ad
91 .RS 6n
92 Prints numbers in octal, not decimal.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fB-V\fR\fR
99 .ad
100 .RS 6n
101 Prints the version information for the \fBsize\fR command on the standard error
102 output.
106 .ne 2
108 \fB\fB-x\fR\fR
110 .RS 6n
111 Prints numbers in hexadecimal, not decimal.
114 .SH EXAMPLES
117 The examples below are typical \fBsize\fR output.
119 \fBExample 1 \fRProducing size information
121 .in +2
123 example% \fBsize \fIfilename\fR\fR
124 2724 + 88 + 0 = 2812
126 .in -2
130 \fBExample 2 \fRProducing allocatable section size information
132 .in +2
134 example% \fBsize -f \fIfilename\fR\fR
135 26(.text) + 5(.init) + 5(.fini) = 36
137 .in -2
141 \fBExample 3 \fRProducing loadable segment size information
143 .in +2
145 example% \fBsize -F \fIfilename\fR\fR
146 2724(r-x) + 88(rwx) + 0(rwx) = 2812 ... \fI(If statically linked)\fR
148 .in -2
151 .SH SEE ALSO
154 \fBas\fR(1), \fBld\fR(1), \fBar.h\fR(3HEAD), \fBa.out\fR(4),
155 \fBattributes\fR(5)
156 .SH NOTES
159 Since the size of bss sections is not known until link-edit time, the
160 \fBsize\fR command will not give the true total size of pre-linked objects.