Large code size?

Sam Lantinga slouken@devolution.com
Wed Mar 24 15:42:00 GMT 1999


> > > > The egcs version (compiled with egcs 1.1.1, -O2 -funroll-loops):
> > > > -rwxrwxr-x   1 hercules devel     1534443 Mar 25  1999 robotcom.so
> > > > 
> > > > The VC++ version (compiled with VC++ 5.0, /G5 /Ox /Ot /Og /Oi /Op /Ob2)
> > > > -r-xr-xr-x   1 hercules devel      654336 Mar 14 10:26 robotcom.dll
> > > > 
> > > > Any ideas why this might be? 
> > 
> > > Did you try to apply 'strip.exe' to the resulting binary?

> What does

> # size robotcom.so
> # file robotcom.so

> say? BTW, how did you make robotcom.so?


We built robotcom.so with the compiler flags:
	g++ -O2 -funroll-loops -fno-exceptions -DLINUX_BETA -D_REENTRANT
and the linker flags:
	cc -shared -nostartfiles -s -o robotcom.so ...

The final result is:

-rwxrwxr-x   1 hercules devel     1011648 Mar 25 07:35 robotcom.so
[hercules@asgard robotcom]$ size robotcom.so
   text    data     bss     dec     hex filename
 991092    9768  198820 1199680  124e40 robotcom.so
[hercules@asgard robotcom]$ file robotcom.so
robotcom.so: ELF 32-bit LSB shared object, Intel 80386, version 1, stripped
[hercules@asgard robotcom]$ ldd robotcom.so
        libc.so.6 => /lib/libc.so.6 (0x4012a000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)

Removing -funroll-loops from the flags gives us:
-rwxrwxr-x   1 hercules devel      948704 Mar 25 07:42 robotcom.so

I'm rebuilding the entire application with those flags now.
--
	-Sam Lantinga				(slouken@devolution.com)

Lead Programmer, Loki Entertainment Software
--
Author of Simple DirectMedia Layer -
	http://www.devolution.com/~slouken/SDL/
--


More information about the Gcc mailing list