-frecord-gcc-switches as default CFLAG?

Jakub Jelinek jakub at redhat.com
Mon Nov 1 13:12:29 UTC 2010


On Mon, Nov 01, 2010 at 09:04:12AM -0400, Tom "spot" Callaway wrote:
> On 10/30/2010 06:01 AM, Richard W.M. Jones wrote:
> > On Sat, Oct 30, 2010 at 02:24:02AM -0400, Jon Stanley wrote:
> >> I noticed on my Fedora 13 box that in the RPM macro %__global_cflags
> >> that -frecord-gcc-switches is missing, which is a nifty compiler
> >> feature that will record the flags passed to gcc in a section in the
> >> object file, thus aiding in the "how in the world was this compiled?"
> >> problem. An example:
> >>
> >> [jstanley at hawtness ~]$ gcc -O2 -frecord-gcc-switches -g -o hello hello.c
> >> [jstanley at hawtness ~]$ readelf -p .GCC.command.line hello
> >>
> >> String dump of section '.GCC.command.line':
> >>   [     0]  hello.c
> >>   [     8]  -mtune=generic
> >>   [    17]  -g
> >>   [    1a]  -O2
> >>   [    1e]  -frecord-gcc-switches
> >>
> >> What do folks think about adding this as a default? Any reason not to
> >> (other than possibly a few bytes extra in the object files)?
> > 
> > +1
> > 
> > I think would also catch those cases where some gcc flag is found to
> > break code generation.  You reasonably see which binaries were
> > affected.
> 
> I agree. Unless there is a notable performance cost in this, I say we
> should go for it.

-frecord-gcc-switches is unfortunately pretty much useless, see
http://gcc.gnu.org/PR32998.  Please don't add it, we want something actually
usable, not this option.

	Jakub


More information about the devel mailing list