From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4E81E3858D1E; Thu, 11 May 2023 20:51:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E81E3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683838309; bh=tN8+8t06QGxq1oS2HBxgNQ/NsUqn2s5Vtp9JQMvQSEs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=f6o/eepYyTfHan6O5xLGMa4vNB8UyQS5IGN2gZtowm3EYSfPbcr9wQgYK9fwY5CtR dqzmLRwDaIYOj7fXb0eZYl0kM3w5jxZx2smVnIxyoEBqFugMqgOeJVaWlVKBoGh3hY lnEHa3i+HSMCVcR7xwxRyFH+03wiu9zwZ2gZS5Q0= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109816] [13/14 Regression] r14-321 fix for PR108969 breaks NVPTX offloading due to __asm (".globl _ZSt21ios_base_library_initv") Date: Thu, 11 May 2023 20:51:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109816 --- Comment #6 from Tobias Burnus --- (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 =E2=80=94 and t= hat section (enum value) is only used by lto_output_toplevel_asms/lto_input_toplevel_as= ms. 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=