SIZE(1)
π SIZE(1) Β· GNU Development Tools π
π¦ NAME π¦
size - list section sizes and total size of binary files β¨
πΈ SYNOPSIS πΈ
size [-A|-B|-G|--format=compatibility]
[--help]
[-d|-o|-x|--radix=number]
[--common]
[-t|--totals]
[--target=bfdname] [-V|--version]
[-f]
[objfile...]
π DESCRIPTION π
okay so the GNU size utility lists the section sizes and the total size for each of the binary files objfile on its argument list π₯ by default you get one line of output per file, or per module if the file is an archive.
objfile... are the files to be examined. if you don't name any, it'll just grab the file "a.out" instead π§
β¨ OPTIONS β¨
the command-line options have the following meanings, bestie π
-A,-B,-G,--format=compatibilityβ this is where you pick the vibe of the output π-A(or--format=sysv) makes it look like System Vsize,-B(or--format=berkeley) makes it look like Berkeleysize, and-G(or--format=gnu) gives you GNU format, which is similar to Berkeley but the sizes are counted differently π the default is the one-line format that's similar to Berkeley's.
here's the Berkeley (default) format, which is giving classic π:
$ size --format=Berkeley ranlib size
text data bss dec hex filename
294880 81920 11592 388392 5ed28 ranlib
294880 81920 11888 388688 5ee50 size
okay so Berkeley style counts read only data in the "text" column, not in "data" π the "dec" and "hex" columns both show the sum of "text", "data", and "bss", in decimal and hexadecimal respectively.
GNU format is the other flavour π it counts read only data in the "data" column, not "text", and it only shows the sum of "text", "data", and "bss" once, in the "total" column. you can use the --radix option to change the number base for all columns. same data, GNU conventions:
text data bss total filename
279880 96920 11592 388392 ranlib
279880 96920 11888 388688 size
and this is the same data again, but closer to System V conventions π
$ 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
--help,-h,-H,-?β show a summary of acceptable arguments and options π§-d,-o,-x,--radix=numberβ control whether each section's size shows up in decimal (-dor--radix=10), octal (-oor--radix=8), or hexadecimal (-xor--radix=16) π with--radix=number, only the three values (8, 10, 16) are supported. the total size is always shown in two radices: decimal and hexadecimal for-dor-xoutput, or octal and hexadecimal if you're using-o.--commonβ prints the total size of common symbols in each file. with Berkeley or GNU format, these get included in the bss size π«Ά-t,--totalsβ shows totals of all objects listed (Berkeley or GNU format mode only) π--target=bfdnameβ tellssizethat the object-code format for objfile is bfdname. this might not be necessary, sincesizecan automatically recognise lots of formats π¦-v,-V,--versionβ displays the version number ofsizeβ¨-fβ ignored π other versions ofsizeuse this one, but the GNU Binutils version doesn't support it.@fileβ reads command-line options from file π the options read are inserted in place of the original@fileoption. if file doesn't exist or can't be read, the option gets treated literally and isn't removed.
options inside file are separated by whitespace. to include a whitespace character in an option, wrap the entire option in single or double quotes. any character (including a backslash) can be included by putting a backslash in front of it. the file can also have its own @file options, and those get processed recursively πΈ
π¦ SEE ALSO π¦
ar(1), objdump(1), readelf(1), and the Info entries for binutils π
π₯ COPYRIGHT π₯
Copyright (c) 1991-2025 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".
okay bestie that's the whole tea π«Ά this page was brought to you by binutils-2.45, dated 2025-12-03, filed under SIZE(1) π β¨
π¦ where this page comes from
- ubuntu questing: binutils-common 2.45-7ubuntu1.2
- ubuntu questing: binutils-x86-64-linux-gnu 2.45-7ubuntu1.2
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms