This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Large code size?


> 
> 
> > > 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 ...
> ...

> That's a whopping 4.5MB decrease in size just by using -fno-exceptions
> It's still 25% larger than the equivalent VC++ code (which does have
> exception handling enabled, BTW), but .5 MB of that is additional library
> code that is a separate DLL on Windows, for a final count of only 17%
> larger.

What happens if you replace -O2 with -Os?  (optimize for space ... which
in many cases does a fairly decent job of optimizing for speed as well)?
You should get smaller code.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]