Mainline bootstrap failure (Re: libstdc++ execute tests)

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Apr 12 09:06:00 GMT 2001


At 16:30 12.04.2001, Alexandre Oliva wrote:
>On Apr 12, 2001, Franz Sirl <Franz.Sirl-kernel@lauterbach.com> wrote:
>
> > Yes, and what's the problem? You didn't tell to override
> > optimizations, you just told to generate debug information. For
> > overriding optimizations you pass CFLAGS="-g -O0" as with any other
> > package that defaults to certain optimizations that are not handled
> > directly via CFLAGS.
>
> http://www.gnu.org/prep/standards_52.html:
>
>         If there are C compiler options that must be used for proper
>         compilation of certain files, do not include them in
>         CFLAGS. Users expect to be able to specify CFLAGS freely
>         themselves. Instead, arrange to pass the necessary options to
>         the C compiler independently of CFLAGS
>
>         [...]
>
>         Do include the `-g' option in CFLAGS, because that is not
>         required for proper compilation. You can consider it a default
>         that is only recommended. If the package is set up so that it
>         is compiled with GCC by default, then you might as well
>         include `-O' in the default value of CFLAGS as well.
>
>         Put CFLAGS last in the compilation command, after other
>         variables containing compiler options, so the user can use
>         CFLAGS to override the others.
>
>-O2 is certainly not necessary for proper compilation.  It shouldn't
>be used in addition to CFLAGS; CFLAGS should override it.

Well, gcc is very special here and it's actually a good thing that way 
IMHO. I would rather have BOOT_CFLAGS = -O2 -g without _any_ CFLAGS 
involved and always requiring direct override via passing BOOT_CFLAGS from 
toplevel.

CFLAGS in the gcc case simply is much too overloaded, for a big overhaul I 
would prefer to rip out CFLAGS from *anything* that is not related to the 
host environment (eg. no uses of pure CFLAGS in gcc/Makefile.in at all...).
All other uses of CFLAGS are just convenient shortcuts for gcc developers 
IMHO, and should _only_ be controlled by things like HOST_CFLAGS, 
BOOT_CFLAGS, STAGE1_CFLAGS, TARGET_CFLAGS, TARGET_CXXFLAGS, etc.

Say you are on sparc-solaris and want to bootstrap a native compiler with 
the system compiler. A "make bootstrap CFLAGS=<system-compilerflags>" or 
"make bootstrap CFLAGS=<gcc-compilerflags>" is rather senseless then, as 
both won't work correctly without passing accompanying variables.

Simply try one thing, document how to sensibly use CFLAGS with gcc, 
covering all cases like systemcompiler!=gcc, cross vs. native...

Franz.



More information about the Gcc-patches mailing list