LLVM-SIZE(1)

πŸ“¦
version 12.0.1 Β· 4 versions
, in fedora 43, fedora 44

✨ NAME ✨

llvm-size β€” bestie, it prints size information πŸ’– (this is the LLVM manual, section 1, so you know exactly which family it came from 🫢)


🌸 SYNOPSIS 🌸

llvm-size [options] [input...]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so llvm-size is the tool that prints size information for binary files, and honestly it's giving drop-in replacement for GNU's size. no cap. πŸ‘‘

Here's the vibe: it prints size info for every single input you hand it. If you give it no input at all, it just goes ahead and prints size info for a.out. And if you pass - as an input file, llvm-size reads a file from the standard input stream (yes, it's flexible like that πŸ’…). And if one of your inputs is an archive? It displays size information for all its members, every single one, no member left behind ✨


πŸ’… OPTIONS πŸ’…

  • -A β€” literally just --format with a value of sysv. same energy.
  • --arch=<arch> β€” Architecture(s) from Mach-O universal binaries to display information for. tell it which arch you want, bestie πŸŽ€
  • -B β€” equivalent to --format with a value of berkeley.
  • --common β€” Include ELF common symbol sizes in bss size for berkeley output format, or as a separate section entry for sysv output. If you don't specify it, those symbols are ignored, periodt. πŸ™ˆ
  • -d β€” equivalent to --radix with a value of 10.
  • -l β€” Display verbose address and offset information for segments and sections in Mach-O files in darwin format. the detailed version, the main character version πŸ‘‘
  • --format=<format> β€” Set the output format to the <format> you specified. The available <format> options are berkeley (the default), sysv and darwin. let's break each one down because they're all different and all iconic:

Berkeley output summarises text, data and bss sizes in each file, like this, shown below for a typical pair of ELF files:

$ llvm-size --format=berkeley test.o test2.o
   text    data     bss     dec     hex filename
    182      16       5     203      cb test.elf
     82       8       1      91      5b test2.o

For Mach-O files, the output format is slightly different:

$ llvm-size --format=berkeley macho.obj macho2.obj
__TEXT  __DATA  __OBJC  others  dec     hex
4       8       0       0       12      c       macho.obj
16      32      0       0       48      30      macho2.obj

Sysv output displays size and address information for most sections, with each file being listed separately:

$ llvm-size --format=sysv test.elf test2.o
   test.elf  :
   section       size      addr
   .eh_frame       92   2097496
   .text           90   2101248
   .data           16   2105344
   .bss             5   2105360
   .comment       209         0
   Total          412

   test2.o  :
   section             size   addr
   .text                 26      0
   .data                  8      0
   .bss                   1      0
   .comment             106      0
   .note.GNU-stack        0      0
   .eh_frame             56      0
   .llvm_addrsig          2      0
   Total                199

darwin format only affects Mach-O input files, iykyk. If you specify an input of a different file format, llvm-size falls back to berkeley format. When producing darwin format, the tool displays information about segments and sections:

$ llvm-size --format=darwin macho.obj macho2.obj
   macho.obj:
   Segment : 12
           Section (__TEXT, __text): 4
           Section (__DATA, __data): 8
           total 12
   total 12
   macho2.obj:
   Segment : 48
           Section (__TEXT, __text): 16
           Section (__DATA, __data): 32
           total 48
   total 48
  • --help, -h β€” Display a summary of command line options. your little cheat sheet 🫢
  • --help-list β€” Display an uncategorized summary of command line options. the raw, unfiltered version 🌈
  • -m β€” equivalent to --format with a value of darwin.
  • -o β€” equivalent to --radix with a value of 8.
  • --radix=<value> β€” Display size information in the specified radix. The permitted values are 8, 10 (the default) and 16 for octal, decimal and hexadecimal output respectively. pick your number system, bestie, live your truth 🧚

Example:

$ llvm-size --radix=8 test.o
   text    data     bss     oct     hex filename
   0152      04      04     162      72 test.o

$ llvm-size --radix=10 test.o
   text    data     bss     dec     hex filename
    106       4       4     114      72 test.o

$ llvm-size --radix=16 test.o
   text    data     bss     dec     hex filename
   0x6a     0x4     0x4     114      72 test.o
  • --totals, -t β€” Applies only to berkeley output format. Display the totals for all listed fields, in addition to the individual file listings. the grand finale of numbers πŸ”₯

Example:

$ llvm-size --totals test.elf test2.o
   text    data     bss     dec     hex filename
    182      16       5     203      cb test.elf
     82       8       1      91      5b test2.o
    264      24       6     294     126 (TOTALS)
  • --version β€” Display the version of the llvm-size executable. know your build, queen πŸ’œ
  • -x β€” equivalent to --radix with a value of 16.
  • @<FILE> β€” Read command-line options from response file <FILE>. yes, it'll read your options out of a whole file, iconic behaviour ⭐

πŸŽ€ EXIT STATUS πŸŽ€

llvm-size exits with a non-zero exit code if there is an error. Otherwise? It exits with code 0. that's it, that's the whole story. clean, simple, slay. ✨


πŸ’€ BUGS πŸ’€

To report bugs, please visit <https://bugs.llvm.org/>. tell them everything, bestie, they wanna know πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/). absolute legends, fr fr 🫢


2003-2024, LLVM Project


and that's the whole page!! mwah πŸ’– this was the llvm-size man page from LLVM 12, dated 2024-07-18 β€” go forth and measure your binaries, bestie, you've got this πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from