2003-02-10 11:02:07

by devnetfs

[permalink] [raw]
Subject: compiling kernel with debug and optimization

Hello,

Does compiling with -g option degrade performance? IMO it should NOT.

If that's true, then why dont we compile kernels with both -g and -O2
always? Also does using -g AND -O2 cause some optimizations to be
missed out?

Thanks in advance,

Regards,
A.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


2003-02-10 11:23:04

by Keith Owens

[permalink] [raw]
Subject: Re: compiling kernel with debug and optimization

On Mon, 10 Feb 2003 03:11:51 -0800 (PST),
devnetfs <[email protected]> wrote:
>Does compiling with -g option degrade performance? IMO it should NOT.

Compiling with -g slows down compilation and link, mainly because of
the extra debugging data that has to be copied around. -g
significantly increases disk usage.

>If that's true, then why dont we compile kernels with both -g and -O2
>always? Also does using -g AND -O2 cause some optimizations to be
>missed out?

With gcc, compiling with -g should have no effect on the kernel. One
of my occasional tests is to build vmlinux with and without -g, run
both through strip -g and compare the results. They should be
identical except for the build timestamp.

2003-02-10 16:19:24

by devnetfs

[permalink] [raw]
Subject: Re: compiling kernel with debug and optimization

Thanks for you reply Keith :)

The reason I asked this question is -- Distro's like RH (i guess it
holds for others too) DONT distribute kernels compiled with -g and
I was wondering why?

Agreed about the compile-time+disk overhead, but that's ONE time
affair. Analyzing a system-core-dump of a "-g" built kernel (using
MCL's crash) is much easier and fruitful than otherwise.

so is it (just) the disk-space overhead that keeps distributions
from NOT compiling with "-g" option?!

Thanks once again,

Regards,
A.



--- Keith Owens <[email protected]> wrote:
> On Mon, 10 Feb 2003 03:11:51 -0800 (PST),
> devnetfs <[email protected]> wrote:
> >Does compiling with -g option degrade performance? IMO it should
> NOT.
>
> Compiling with -g slows down compilation and link, mainly because of
> the extra debugging data that has to be copied around. -g
> significantly increases disk usage.
>
> >If that's true, then why dont we compile kernels with both -g and
> -O2
> >always? Also does using -g AND -O2 cause some optimizations to be
> >missed out?
>
> With gcc, compiling with -g should have no effect on the kernel. One
> of my occasional tests is to build vmlinux with and without -g, run
> both through strip -g and compare the results. They should be
> identical except for the build timestamp.
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

2003-02-11 10:55:00

by Pavel Machek

[permalink] [raw]
Subject: Re: compiling kernel with debug and optimization

Hi!

> Does compiling with -g option degrade performance? IMO it should NOT.
>
> If that's true, then why dont we compile kernels with both -g and -O2
> always?

Build with -g takes *a lot* of diskspace, like 1Gig.
Pavel

--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

2003-02-11 11:02:16

by Andi Kleen

[permalink] [raw]
Subject: Re: compiling kernel with debug and optimization

Pavel Machek <[email protected]> writes:

> Hi!
>
> > Does compiling with -g option degrade performance? IMO it should NOT.
> >
> > If that's true, then why dont we compile kernels with both -g and -O2
> > always?
>
> Build with -g takes *a lot* of diskspace, like 1Gig.

With gcc 3.x and its dwarf2 default.

It's a lot smaller when you compile with -gstabs (on i386)
stabs works as well for 32bit, but is much more compact.

-Andi

2003-02-12 05:11:09

by devnetfs

[permalink] [raw]
Subject: Re: compiling kernel with debug and optimization

--- Pavel Machek <[email protected]> wrote:
> Hi!
>
> > Does compiling with -g option degrade performance? IMO it should
> > NOT.
> > If that's true, then why dont we compile kernels with both -g and
> > -O2 always?
>
> Build with -g takes *a lot* of diskspace, like 1Gig.
> Pavel

Agreed. But can't distro's give two SET's of RPMS:
1. kernel-xyz.rpm
2. kernel-xyz-debug.rpm

where both 1,2 are same kernels compiled w/ same config and with -g.
BUT rpm [1] is a 'strip -g' output of [2].

So people run [1] on their production systems. And developers analyze
core-dump from these systems using [2]. Can this be done and will it
work?

Thanks in advance,

Regards,
A.


ps: Please Cc: me the reply. I am not subscribed to the list.

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com