blob: 1401678c66db61078d6c9924f7d5b5a6fee2688e [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="ranlib.html#ranlib" title="ranlib">
<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-2019 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>
</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="ranlib.html#ranlib">ranlib</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-122"></a><a name="index-section-sizes-123"></a>
<!-- man title size list section sizes and total size of binary files -->
<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">-G</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 and the total
size for each of the binary files <var>objfile</var> on its argument list.
By default, one line of output is generated for each file or each
module if the file is an archive.
<p><var>objfile</var><small class="dots">...</small> are the files to be examined. If none are
specified, the file <code>a.out</code> will be used instead.
<!-- 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">-G</span></samp><dt><samp><span class="env">--format=</span><var>compatibility</var></samp><dd><a name="index-g_t_0040command_007bsize_007d-display-format-124"></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. Alternatively, you can choose the GNU format output
(using <samp><span class="option">-G</span></samp>, or <samp><span class="option">--format=gnu</span></samp>), this is similar to
Berkeley's output format, but sizes are counted differently.
<!-- 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>The Berkeley style output counts read only data in the <code>text</code>
column, not in the <code>data</code> column, the <code>dec</code> and <code>hex</code>
columns both display the sum of the <code>text</code>, <code>data</code>, and
<code>bss</code> columns in decimal and hexadecimal respectively.
<p>The GNU format counts read only data in the <code>data</code> column, not
the <code>text</code> column, and only displays the sum of the <code>text</code>,
<code>data</code>, and <code>bss</code> columns once, in the <code>total</code> column.
The <samp><span class="option">--radix</span></samp> option can be used to change the number base for
all columns. Here is the same data displayed with GNU conventions:
<pre class="smallexample"> $ size --format=GNU ranlib size
text data bss total filename
279880 96920 11592 388392 ranlib
279880 96920 11888 388688 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-125"></a><a name="index-radix-for-section-sizes-126"></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
or GNU 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 or GNU format mode only).
<br><dt><samp><span class="env">--target=</span><var>bfdname</var></samp><dd><a name="index-object-code-format-127"></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>