[LLVMdev] Executable file size comparison

Richard Pennington rich at pennware.com
Wed Dec 7 12:43:15 PST 2011


I compiled a program and standard library using clang/LLVM and found the 
results interesting:

   text    data     bss     dec     hex filename
 141312    4076   16668  162056   27908 bzip2.arm
 131764    4076   16668  152508   253bc bzip2.armv7
 134748    4048   16624  155420   25f1c bzip2.i386
 259112    4028   16732  279872   44540 bzip2.microblaze
 168044    4040   16816  188900   2e1e4 bzip2.mips
 167860    4040   16816  188716   2e12c bzip2.mips32r2
 179032    4040   16816  199888   30cd0 bzip2.mips32r2elsf
 179008    4040   16816  199864   30cb8 bzip2.mips32r2sf
 168060    4040   16816  188916   2e1f4 bzip2.mipsel
 156312    4028   16784  177124   2b3e4 bzip2.ppc
 163572   10896   19280  193748   2f4d4 bzip2.ppc64
 145443    4696   19368  169507   29623 bzip2.x86_64

The libraries were compiled with -O1 and the program was compiled with -O2. 
The whole thing was statically linked. I verified that each executable was 
correct by running the bzip2 test cases under QEMU.

It is interesting to see how the architecture (and maybe maturity of the code 
generator) affects code size.

-Rich



More information about the llvm-dev mailing list