Why is the binary much larger than the object files?
Henrik Mannerström
henrik.mannerstrom@gmail.com
Tue Jul 9 12:39:00 GMT 2013
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
More information about the Gcc-help
mailing list