[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5


size Command

The size command includes information for size on a POWER-based platform and an size on an Itanium-based platform.

size Command on POWER-based Platform

Purpose

Displays the section sizes of the Extended Common Object File Format (XCOFF) object files.

Syntax

size-d -o -x ] [  -f ] [  -V ] [  -X  {32|64|32_64}] FileFile ... ]

Description

The size command writes to standard output the number of bytes required by all sections, along with their sum for each XCOFF file. If the -f flag is specified, the section name follows the section size.

Flags

The output is in decimal notation unless you change the output with the following flags:

-d Writes in decimal notation.
-f Writes the section name in parenthesis following the section size.
-o Writes in octal notation.
-x Writes in hexadecimal notation.
-X mode Specifies the type of object file size should examine. The mode must be one of the following:

32
Processes only 32-bit object files

64
Processes only 64-bit object files

32_64
Processes both 32-bit and 64-bit object files

The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set with the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes size to process any 64-bit objects and ignore 32-bit objects. The -X flag overrides the OBJECT_MODE variable.

-V Prints the version number of the size command.

Examples

  1. To display the size of the a.out file in decimal, enter:

    size
    

    This displays the size in bytes of the executable a.out file. The size of each section of the object file is given, followed by the total:

    3720 + 1752 + 4152 = 9624
    
  2. To display the size of an object file in octal, enter:

    size -o driver.o
    

    This displays the size of the driver.o object file in octal.

  3. To display the size of several object files in hexadecimal, enter:

    size -x *.o
    

    This displays in hexadecimal the size of each file ending with .o in the current directory.

Related Information

The ar command, as command, dump command, ld command, nm command, strip command.

size Command on Itanium-based Platform

Purpose

Print section sizes in bytes of object files.

Syntax

size [ -F -f -n -o -V -x ] files

Description

The size command produces segment or section size information in bytes for each loaded section in ELF object files. size prints out the size of the text, data, and bss (uninitialized data) segments (or sections) and their total.

size processes ELF object files entered on the command line. If an archive file is input to the size command, the information for each object file in the archive is displayed.

When calculating segment information, the size command prints out the total file size of the non-writable segments, the total file size of the writable segments, and the total memory size of the writable segments minus the total file size of the writable segments.

If it cannot calculate segment information, size calculates section information. When calculating section information, it prints out the total size of sections that are allocatable, non-writable, and not NOBITS, the total size of the sections that are allocatable, writable, and not NOBITS, and the total size of the writable sections of type NOBITS. (NOBITS sections do not actually take up space in the file.)

If size cannot calculate either segment or section information, it prints an error message and stops processing the file.

-F
Prints out the size of each loadable segment, the permission flags of the segment, then the total of the loadable segment sizes. If there is no segment data, size prints an error message and stops processing the file.

-f
Prints out the size of each allocatable section, the name of the section, and the total of the section sizes. If there is no section data, size prints out an error message and stops processing the file.

-n
Prints out non-loadable segment or non-allocatable section sizes. If segment data exists, size prints out the memory size of each loadable segment or file size of each non-loadable segment, the permission flags, and the total size of the segments. If there is no segment data, size prints out, for each allocatable and non-allocatable section, the memory size, the section name, and the total size of the sections. If there is no segment or section data, size prints an error message and stops processing.

-o
Prints numbers in octal, not decimal.

-V
Prints the version information for the size command on the standard error output.

-x
Prints numbers in hexadecimal; not decimal.

Examples

The examples below are typical size output.

   size file              2724 + 88 + 0 =  2812
 
   size -f file           26(.text) + 5(.init) + 5(.fini)  = 36
 
   size -F file           2724(r-x) + 88(rwx) + 0(rwx) = 2812

Related Information

The a.out file format, ar file format.

The ar command, as command, cc command, dump command, and ld command.

Notices

Since the size of bss sections is not known until link-edit time, the size command does not give the true total size of pre-linked objects.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]