blob: d6d5cf41029219e06c993ee7be3ac4cb01a55efd [file] [log] [blame]
<html lang="en">
<head>
<title>size - GNU Binary Utilities</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Binary Utilities">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="readelf.html#readelf" title="readelf">
<link rel="next" href="strings.html#strings" title="strings">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="size"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="strings.html#strings">strings</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="readelf.html#readelf">readelf</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">6 size</h2>
<p><a name="index-size-105"></a><a name="index-section-sizes-106"></a>
<!-- man title size list section sizes and total size. -->
<pre class="smallexample"> <!-- man begin SYNOPSIS size -->
size [<samp><span class="option">-A</span></samp>|<samp><span class="option">-B</span></samp>|<samp><span class="option">--format=</span></samp><var>compatibility</var>]
[<samp><span class="option">--help</span></samp>]
[<samp><span class="option">-d</span></samp>|<samp><span class="option">-o</span></samp>|<samp><span class="option">-x</span></samp>|<samp><span class="option">--radix=</span></samp><var>number</var>]
[<samp><span class="option">--common</span></samp>]
[<samp><span class="option">-t</span></samp>|<samp><span class="option">--totals</span></samp>]
[<samp><span class="option">--target=</span></samp><var>bfdname</var>] [<samp><span class="option">-V</span></samp>|<samp><span class="option">--version</span></samp>]
[<var>objfile</var>...]
<!-- man end -->
</pre>
<!-- man begin DESCRIPTION size -->
<p>The <span class="sc">gnu</span> <samp><span class="command">size</span></samp> utility lists the section sizes&mdash;and the total
size&mdash;for each of the object or archive files <var>objfile</var> in its
argument list. By default, one line of output is generated for each
object file or each module in an archive.
<p><var>objfile</var><small class="dots">...</small> are the object files to be examined.
If none are specified, the file <code>a.out</code> will be used.
<!-- man end -->
<!-- man begin OPTIONS size -->
<p>The command line options have the following meanings:
<dl>
<dt><samp><span class="env">-A</span></samp><dt><samp><span class="env">-B</span></samp><dt><samp><span class="env">--format=</span><var>compatibility</var></samp><dd><a name="index-g_t_0040command_007bsize_007d-display-format-107"></a>Using one of these options, you can choose whether the output from <span class="sc">gnu</span>
<samp><span class="command">size</span></samp> resembles output from System V <samp><span class="command">size</span></samp> (using <samp><span class="option">-A</span></samp>,
or <samp><span class="option">--format=sysv</span></samp>), or Berkeley <samp><span class="command">size</span></samp> (using <samp><span class="option">-B</span></samp>, or
<samp><span class="option">--format=berkeley</span></samp>). The default is the one-line format similar to
Berkeley's.
<!-- Bonus for doc-source readers: you can also say -format=strange (or -->
<!-- anything else that starts with 's') for sysv, and -format=boring (or -->
<!-- anything else that starts with 'b') for Berkeley. -->
<p>Here is an example of the Berkeley (default) format of output from
<samp><span class="command">size</span></samp>:
<pre class="smallexample"> $ size --format=Berkeley ranlib size
text data bss dec hex filename
294880 81920 11592 388392 5ed28 ranlib
294880 81920 11888 388688 5ee50 size
</pre>
<p class="noindent">This is the same data, but displayed closer to System V conventions:
<pre class="smallexample"> $ size --format=SysV ranlib size
ranlib :
section size addr
.text 294880 8192
.data 81920 303104
.bss 11592 385024
Total 388392
size :
section size addr
.text 294880 8192
.data 81920 303104
.bss 11888 385024
Total 388688
</pre>
<br><dt><samp><span class="env">--help</span></samp><dd>Show a summary of acceptable arguments and options.
<br><dt><samp><span class="env">-d</span></samp><dt><samp><span class="env">-o</span></samp><dt><samp><span class="env">-x</span></samp><dt><samp><span class="env">--radix=</span><var>number</var></samp><dd><a name="index-g_t_0040command_007bsize_007d-number-format-108"></a><a name="index-radix-for-section-sizes-109"></a>Using one of these options, you can control whether the size of each
section is given in decimal (<samp><span class="option">-d</span></samp>, or <samp><span class="option">--radix=10</span></samp>); octal
(<samp><span class="option">-o</span></samp>, or <samp><span class="option">--radix=8</span></samp>); or hexadecimal (<samp><span class="option">-x</span></samp>, or
<samp><span class="option">--radix=16</span></samp>). In <samp><span class="option">--radix=</span><var>number</var></samp>, only the three
values (8, 10, 16) are supported. The total size is always given in two
radices; decimal and hexadecimal for <samp><span class="option">-d</span></samp> or <samp><span class="option">-x</span></samp> output, or
octal and hexadecimal if you're using <samp><span class="option">-o</span></samp>.
<br><dt><samp><span class="env">--common</span></samp><dd>Print total size of common symbols in each file. When using Berkeley
format these are included in the bss size.
<br><dt><samp><span class="env">-t</span></samp><dt><samp><span class="env">--totals</span></samp><dd>Show totals of all objects listed (Berkeley format listing mode only).
<br><dt><samp><span class="env">--target=</span><var>bfdname</var></samp><dd><a name="index-object-code-format-110"></a>Specify that the object-code format for <var>objfile</var> is
<var>bfdname</var>. This option may not be necessary; <samp><span class="command">size</span></samp> can
automatically recognize many formats.
See <a href="Target-Selection.html#Target-Selection">Target Selection</a>, for more information.
<br><dt><samp><span class="env">-V</span></samp><dt><samp><span class="env">--version</span></samp><dd>Display the version number of <samp><span class="command">size</span></samp>.
</dl>
<!-- man end -->
</body></html>