size of kernel after gcc4.2 upgrade

Stefan Ehmann shoesoft at gmx.net
Sat May 26 10:48:41 UTC 2007


On Friday 25 May 2007 17:05:17 Roman Divacky wrote:
> On Fri, May 25, 2007 at 04:02:47PM +0200, Stefan Ehmann wrote:
> > On Friday 25 May 2007 11:51:46 Roman Divacky wrote:
> > > hi
> > >
> > > I just noticed that
> > > spravci ~# ls -l /boot/kernel*/kernel
> > > -r-xr-xr-x  1 root  wheel  3389971 May 18 12:03
> > > /boot/kernel.old/kernel* -r-xr-xr-x  1 root  wheel  5211345 May 25
> > > 11:47 /boot/kernel/kernel*
> > >
> > > ie. after gcc42 import the kernel size increased roughly by 60% thats
> > > a little too much. is there any forgotten option or something that
> > > makes the kernel grow so big?
> >
> > While I also see an increase, it's not that much.
> >
> > GENERIC from today's current, also compiled with gcc34 from ports (I had
> > to delete two gcc options in sys/conf/kern.mk):
> >
> > gcc34: 6530916
> > gcc42: 7352560
> > gcc34 -Os: 6074468
> > gcc42 -Os: 10058032
>
> yes, thats it! I also used -Os. it looks like this occurs only with -Os
> optimization level.
>
> can someone else confirm this? and/or possibly explain this?

-Os seems to do more inlining than -O.

Maybe this is a gcc bug, we use strange options for the buildkernel or who 
knows what.

If I use INLINE_LIMIT=600, I get a more reasonable sized kernel (600 is the 
gcc default, /sys/conf/kern.mk sets it to 8000). But it's still larger than 
the -O compile.

If I further lower INLINE_LIMIT to 50:
-Os: 5876816
-O:  7154096

This numbers finally look sane for a -Os build. Doing this is probably not a 
good idea but maybe this points to the cause of the size increase.


More information about the freebsd-current mailing list