https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109816

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> The above can work only if toplevel asms are in separate section and so
> inputting it or not doesn't affect input of other data.
> I think it would be better to also not to stream it if lto_stream_offload_p.

The toplevel asms are in a special section: LTO_section_asm — and that section
(enum value) is only used by lto_output_toplevel_asms/lto_input_toplevel_asms.

The output symbols are in symtab->first_asm_symbol(); and all symbols added
there are added through symbol_table::finalize_toplevel_asm(t).


However, if you don't want to stream it out, we could do the following to
prevent it:

diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc
index 0bca530..853688b 100644
--- a/gcc/lto-streamer-out.cc
+++ b/gcc/lto-streamer-out.cc
@@ -2525,3 +2525,4 @@ lto_output_toplevel_asms (void)

-  if (!symtab->first_asm_symbol ())
+  /* Skip if there is no LTO but only flag_generate_offload.  */
+  if ((!in_lto_p && !flag_lto) || !symtab->first_asm_symbol ())
     return;
--- a/gcc/lto-cgraph.cc
+++ b/gcc/lto-cgraph.cc
@@ -1587,3 +1587,5 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,

+#ifndef ACCEL_COMPILER
   lto_input_toplevel_asms (file_data, file_data->order_base);
+#endif

Reply via email to