Hi Sam,

On Sat, Sep 06, 2025 at 09:38:28PM +0100, Sam James wrote:
> STAGE1_CFLAGS can be used to accelerate the just-built stage1 compiler
> which especially improves its performance on some of the large generated
> files during bootstrap. It defaults to nothing (i.e. -O0).
> 
> The downside is that if the native compiler is buggy, there's a greater
> risk of a failed bootstrap. Those with a modern native compiler, ideally
> a recent version of GCC, should be able to use -O1 or -O2 without issue
> to get a faster build.
> 
>       PR rtl-optimization/111619
>       * doc/install.texi (Building a native compiler): Discuss STAGE1_CFLAGS.
> ---
> Sorry, I'd completely forgot about this and only noticed when trying to reduce
> my local branch and get more things ready to submit..
> 
> This takes your suggestion as-is with some minor phrasing tweaks. I agree
> with your take here and think this works better indeed.
> 
> OK?

I cannot approve, but the text reads OK to me.  The buildbot workers
of builder.sourceware.org do use STAGE1_CFLAGS='-O2' when doing gcc
bootstraps.

>  gcc/doc/install.texi | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
> index fc771448274a..576b7eead5ec 100644
> --- a/gcc/doc/install.texi
> +++ b/gcc/doc/install.texi
> @@ -3125,6 +3125,13 @@ Again, if the native compiler miscompiles the stage1 
> compiler, you may
>  need to work around this by avoiding non-working parts of the stage1
>  compiler.  Use @code{STAGE1_TFLAGS} to this end.
>  
> +You can use @code{STAGE1_CFLAGS} to set the flags passed to the host compiler
> +when building the stage1 compiler.  The default is to pass @option{-g}, but 
> when
> +the host compiler is GCC, this results in a non-optimized build of the stage1
> +compiler.  You can speed up the bootstrap by using @samp{STAGE1_CFLAGS='-O2'}
> +at the increased risk of miscompiling the stage1 compiler when the host
> +compiler is buggy.
> +
>  If you used the flag @option{--enable-languages=@dots{}} to restrict
>  the compilers to be built, only those you've actually enabled will be
>  built.  This will of course only build those runtime libraries, for
> -- 
> 2.51.0
> 

Reply via email to