SIZE(1) General Commands Manual SourceForge Logo

NAME

sizedisplay section sizes and total size of ELF objects

SYNOPSIS

size [--format=format] [--help] [--radix=radix] [--totals] [--version] [-ABVdhotx] [file ...]

DESCRIPTION

The size utility lists the sizes of ELF sections, and optionally the total size, for each input file specified on the command line. The size utility can operate on ELF objects, on ar(1) archives containing ELF objects, and on core dumps. If no file name is specified on the command-line, a.out is assumed.
The size utility recognized the following options:
 
 
--format=format
Display output using the format specified by argument format. Supported values for this argument are: ‘berkeley’ and ‘sysv’. The default output format is ‘berkeley’. See Display Formats below for more information.
 
 
--help
Display a help message and exit.
 
 
--radix=radix
Display numeric values using the radix specified by argument radix. Supported values for radix are 8, 10 and 16. The default radix is 10.
 
 
--totals
Shows cumulative totals of section sizes from all objects. This option is ignored for System V style output.
 
 
--version
Display a version identifier and exit.
 
 
-A
Equivalent to specifying option --format=sysv.
 
 
-B
Equivalent to specifying option --format=berkeley.
 
 
-V
Equivalent to specifying option --version.
 
 
-d
Equivalent to specifying option --radix=10.
 
 
-h
Equivalent to specifying option --help.
 
 
-o
Equivalent to specifying option --radix=8.
 
 
-t
Equivalent to specifying option --totals.
 
 
-x
Equivalent to specifying option --radix=16.

DISPLAY FORMATS

Berkeley Style Output

If ‘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.
Each line will contain the following whitespace separated fields in order:
  1. The size of the text segment in the object.
  2. The size of the data segment in the object.
  3. The size of the ‘bss’ segment in the object.
  4. 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.
  5. The total size of the object in hexadecimal.
  6. The file name of the object.
If option --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 ‘(TOTALS)’.

System V Style Output

If System V style output is selected, size will output the following information for each object:
  1. The name of the object followed by a colon.
  2. A header line containing the names of fields of subsequent lines.
  3. One line per section present in the object. Each line has three fields:
    1. The name of the section.
    2. Its size, in the selected radix for numeric values.
    3. The address associated with the section, in the selected numeric radix.
  4. A line whose section name field contains the string ‘Total’ and whose size field contains the sum of all reported section sizes.

EXIT STATUS

The size utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

To display the section sizes for /bin/ls use:
$ size /bin/ls 
text       data       bss        dec        hex        filename 
20975      540        392        21907      5593        /bin/ls
To display sizes and total for /bin/ls and /bin/dd in hexadecimal, use:
$ 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)
To display section sizes for /bin/ls in System V format use:
$ 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

SEE ALSO

ar(1), nm(1), objdump(1), readelf(1), strings(1), elf(3), gelf(3)
AT&T Unix Systems Labs, System V Application Binary Interface, http://www.sco.com/developers/gabi/.

HISTORY

The size utility first appeared in Version 6 AT&T UNIX.

AUTHORS

The size utility was re-written by S. Sam Arun Raj <samarunraj@gmail.com> This manual page was written by S. Sam Arun Raj <samarunraj@gmail.com>
August 25, 2011 The Elftoolchain Project