https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109816
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> ---
First, I want to remark that inside lto_output_toplevel_asms,
lto_stream_offload_p is true even with -flto.
However, the following is for output_symtab:
(In reply to Jakub Jelinek from comment #7)
> Not
> --- gcc/lto-cgraph.cc 2023-01-09 13:30:47.105343886 +0100
> +++ gcc/lto-cgraph.cc 2023-05-11 23:05:54.266991677 +0200
> @@ -1023,7 +1023,8 @@ output_symtab (void)
> if (!asm_nodes_output)
> {
> asm_nodes_output = true;
> - lto_output_toplevel_asms ();
> + if (!lto_stream_offload_p)
> + lto_output_toplevel_asms ();
This seems to work, kind of. The only case (I found) where it fails is for:
-flto -fwpa
Because in that case, lto_stream_offload_p == 1. While there is a diagnostic
(warning), it still duly continues and uses the wrong value. The diagnostic is:
cc1plus: warning: command-line option '-fwpa' is valid for LTO but not for C++