Why is the binary much larger than the object files?

Florian Weimer fweimer@redhat.com
Tue Jul 9 13:12:00 GMT 2013


On 07/09/2013 02:11 PM, Henrik Mannerström wrote:
> When compiled with -O2 -flto, the object file sizes are:
>   13216 Jul  9 14:57 RR-jump.o
>   38864 Jul  9 14:57 RR.o
> 238496 Jul  9 14:57 main.o
>   41560 Jul  9 14:57 random.o
>
> Linked with
> gcc -L/usr/lib64/atlas -O2 -flto -msse4  main.o random.o RR.o RR-jump.o
> -lgsl -lcblas -latlas -lstdc++ -o main
> the binary size is
> 4712993 Jul  9 14:57 main

Do you link statically, by chance?  What does "ldd ./main" show?

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Gcc-help mailing list