Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

size(1)

名称

size - 输出目标文件的节大小(以字节为单位)

用法概要

size [-fFhnoVx] [--scale[=item1,item2,...]] file...

描述

size 命令会为 ELF 目标文件中的每个装入节生成分段或节大小信息(以字节为单位)。size 会输出文本、数据和 bss(未初始化的数据)分段(或节)的大小及其总大小。

size 处理输入到命令行的 ELF 目标文件。如果将归档文件输入到 size 命令,则会显示归档中每个目标文件的信息。

计算分段信息时,size 命令会输出不可写分段的总文件大小、可写分段的总文件大小以及可写分段总内存大小减去可写分段总文件大小。

如果它无法计算分段信息,则 size 会计算节信息。计算节信息时,它会输出可分配节、不可写节和非 NOBITS 节的总大小;可分配节、可写节和非 NOBITS 节的总大小,以及类型 NOBITS 的可写节的总大小。NOBITS 节不会实际占用 file 的空间。

如果 size 无法计算分段或节信息,则会输出错误消息。

选项

支持以下选项:

–f

列显每个可分配节的大小、节的名称以及节的总大小。如果没有节数据,则 size 会输出错误消息。

–F

列显每个可装入分段的大小、分段的权限标志,然后是可装入分段的总大小。如果没有分段数据,则 size 会输出错误消息。

–h

以十进制输出数字,并调整为用户可读的格式。The –h option is equivalent to using the –scale=max,1024 option.

–n

列显不可装入分段或不可分配节的大小。如果存在分段数据,则 size 会输出每个可装入分段的内存大小或每个不可装入分段的文件大小、权限标志以及分段的总大小。如果没有分段数据,则 size 会输出各可分配和不可分配节的内存大小、节名称以及节的总大小。如果没有分段或节数据,则 size 会输出错误消息。

–o

列显八进制数字,而不是十进制数字。

–scale[=item1,item2,...]

以十进制输出数字,并调整为用户可读的格式。Scaling is done by repetitively dividing by 1024, unless otherwise specified.

–scale specified without arguments enables default scaled output, and is equivalent to –scale=max,1024.

–scale can be specified with the following arguments.

binary

Scaling is done by repetitively dividing by a scale factor of 1024.The use of binary scaling is indicated by the addition of an 'i' modifier to the suffix (Ki, Mi, Gi, ...).

max

Values are scaled to the largest unit for which the result retains a non-zero integer part.Up to 2 decimal places of fractional output may be shown.

min

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 5 columns, and displayed without the use of fractional output.

minwide

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 8 columns, and displayed without the use of fractional output.

1000

Scaling is done by repetitively dividing by a scale factor of 1000.

1024

Scaling is done by repetitively dividing by a scale factor of 1024.

–V
–-version

输出版本信息。

–x

列显十六进制数字,而不是十进制数字。

–?
–-help

输出用法消息并立即退出。

示例

以下是典型的 size 输出示例。

示例 1 生成大小信息
example% size filename
2724 + 88 + 0 = 2812 
示例 2 生成可分配节大小信息
example% size -f filename
26(.text) + 5(.init) + 5(.fini) = 36 
示例 3 生成可装入分段大小信息
example% size -F filename
2724(r-x) + 88(rwx) + 0(rwx) = 2812

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
developer/base-developer-utilities

另请参见

as(1), ld(1), ar.h(3HEAD), a.out(5), attributes(7)