c/2678: gcc/g++ should stick compilation options into the .o file
Ronald F. Guilmette
rfg@monkeys.com
Mon Apr 30 02:16:00 GMT 2001
The following reply was made to PR c/2678; it has been noted by GNATS.
From: "Ronald F. Guilmette" <rfg@monkeys.com>
To: Phil Edwards <pedwards@disaster.jaj.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/2678: gcc/g++ should stick compilation options into the .o file
Date: Mon, 30 Apr 2001 02:09:48 -0700
In message <20010429214104.A29946@disaster.jaj.com>, you wrote:
>After some sleep, I've concluded that my original idea of using the
>print_switch_values routine might be stupid. I don't think people would like
>
> options passed: -iprefix -D__GNUC__=3 -D__GNUC_MINOR__=1
> -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__
> -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1
> -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__
> -D__tune_pentiumpro__ -D__GNUG__=3 -D_GNU_SOURCE -D__DEPRECATED
> -D__EXCEPTIONS -D__GXX_ABI_VERSION=100
> options enabled: -fpeephole -ffunction-cse -fkeep-static-consts
> -fpcc-struct-return -fgcse-lm -fgcse-sm -fsched-interblock -fsched-spec
> -fbranch-count-reg -fexceptions -fcommon -fgnu-linker -fargument-alias
> -fident -fmath-errno -ftrapping-math -m80387 -mhard-float
> -mno-soft-float -mieee-fp -mfp-ret-in-387
>
>showing up in their object files, for example. (Or do you?)
Yes, it would be perfectly OK to put that all into a .comment or .note
section. Those sections DO NOT get loaded into main memory at run time,
and if necessary, `strip' and be used to remove them after the .o is built.
>The kicker is that the driver doesn't pass down the set of command-line
>options directly to the compiler. It does some translations on them,
>and then adds a bunch of defaults, and then passes /all/ of that down.
That might still be OK. It's better than not having the info at all!
>(Side note: the "options enabled" block are everything that's on by
>default, as modified by the "options passed". If you really wanted to
>re-create the compilation environment for a particular file, you'd need
>to use all of those. The defaults might have changed.)
Good point.
>The compiler does have available a save_argv and save_argc, but that's how
>the "options passed" block is constructed in the first place. We don't
>have any obvious way of distinguishing which options the user passed from
>the default ones added by the specs file.
I don't believe that it is important to draw that distinction anyway.
More information about the Gcc-prs
mailing list