This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Why is the binary much larger than the object files?
- From: Henrik Mannerström <henrik dot mannerstrom at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 09 Jul 2013 15:11:27 +0300
- Subject: Why is the binary much larger than the object files?
Hello,
My binary is some 13 times larger than the object files combined. Am I
doing something wrong or is there a way to reduce the binary size? GCC
version is 4.8.1.
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
When compiled with -O3 -flto, the object files size are:
13440 Jul 9 13:31 RR-jump.o
39216 Jul 9 13:31 RR.o
246752 Jul 9 13:31 main.o
41560 Jul 9 13:31 random.o
Linked with
gcc -L/usr/lib64/atlas -O3 -flto -msse4 main.o random.o RR.o RR-jump.o
-lgsl -lcblas -latlas -lstdc++ -o main
the binary size is
4718392 Jul 9 13:31 main