Re: [PATCH] lto/114655 - -flto=4 at link time doesn't override -flto=auto at compile time

2024-04-09 Thread Richard Biener
On Tue, 9 Apr 2024, Jan Hubicka wrote:

> > The following adjusts -flto option processing in lto-wrapper to have
> > link-time -flto override any compile time setting.
> > 
> > LTO-boostrapped on x86_64-unknown-linux-gnu, testing in progress.
> > 
> > OK for trunk and branches?  GCC 11 seems to be unaffected by this.
> > 
> > Thanks,
> > Richard.
> > 
> > PR lto/114655
> > * lto-wrapper.cc (merge_flto_options): Add force argument.
> > (merge_and_complain): Do not force here.
> > (run_gcc): But here to make the link-time -flto option override
> > any compile-time one.
> Looks good to me.  I am actually surprised we propagate -flto settings
> from compile time at all.  I guess I never tried it since I never
> assumed it to work :)

We do magic now ;)  I think this was done because while people manage
to use CFLAGS=-flto they eventually fail to adjust LDFLAGS and without
plugin auto-loading you won't get LTO and in particular not -flto=auto.

I checked that it now works as expected - fortunately -v now displays
the make invocation command, so it was easy to verify.

Richard.


Re: [PATCH] lto/114655 - -flto=4 at link time doesn't override -flto=auto at compile time

2024-04-09 Thread Jan Hubicka
> The following adjusts -flto option processing in lto-wrapper to have
> link-time -flto override any compile time setting.
> 
> LTO-boostrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> OK for trunk and branches?  GCC 11 seems to be unaffected by this.
> 
> Thanks,
> Richard.
> 
>   PR lto/114655
>   * lto-wrapper.cc (merge_flto_options): Add force argument.
>   (merge_and_complain): Do not force here.
>   (run_gcc): But here to make the link-time -flto option override
>   any compile-time one.
Looks good to me.  I am actually surprised we propagate -flto settings
from compile time at all.  I guess I never tried it since I never
assumed it to work :)

Honza


Re: [PATCH] lto/114655 - -flto=4 at link time doesn't override -flto=auto at compile time

2024-04-09 Thread Jakub Jelinek
On Tue, Apr 09, 2024 at 02:49:09PM +0200, Richard Biener wrote:
> The following adjusts -flto option processing in lto-wrapper to have
> link-time -flto override any compile time setting.
> 
> LTO-boostrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> OK for trunk and branches?  GCC 11 seems to be unaffected by this.
> 
> Thanks,
> Richard.
> 
>   PR lto/114655
>   * lto-wrapper.cc (merge_flto_options): Add force argument.
>   (merge_and_complain): Do not force here.
>   (run_gcc): But here to make the link-time -flto option override
>   any compile-time one.

Ok.

Jakub