From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 322DC394C076 for ; Wed, 23 Sep 2020 14:23:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 322DC394C076 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: Fa9cVg2kK0EduCALuKNvJ4IIhL0FYxEKhvuRhKea8mWYs2sMWn0NXPdqneVZv9mJ1DjeOAhZty sO7BHSedJMRqqXY3huCqraKMJI8AW4r8ASUp0Go0JZPK7o1Xr8slePzYRfmyYGxMEjTKJ00Q6u 6KpzYVdqjd7hWcfVg48s5P7rHvnq1OxZJAjDMrvRhZtVIJZuPP4HzkMX0dE2pWeqdUa4uPM8qp XUc3qTh9xmTs+VRl6XyzAn2d7tQIuqLPhq+qqqYGLcnbnLNznv5DHGBtUkSNCtnEmYv3MeOdPt KAc= X-IronPort-AV: E=Sophos;i="5.77,293,1596528000"; d="diff'?scan'208";a="55417690" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 23 Sep 2020 06:23:49 -0800 IronPort-SDR: 4yM4gIl3KApCNcBPhbDnw8eS/dQVwmgTFyi1BaiiVVi1p9YMUVLpnzP4s95zKYoTllFJuJlNuE TzXg99QflSm/G7yer5qO45k/P1kUkSyUf6dglalvwAiWdqpP2DwF57vKBnOiz6bV7ymG4bzyQl HnmYU22RaJOSkmxHf6WClsMH3MdKTqphPSvBWh9RCYkgwPAAEMVz7XEwehwNskE0I/q7wkxIpu oc7y5qDhzi4Nc6B3ERN/wTJCjrPw1GxDYBfMJjMrTlkVb6+kH/e7+VnMoKRcpsWs51hk9blH1n UaQ= Subject: [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179) (was: lto-wrapper.c: Use -flto-partition=none with offloading (PR97179)) To: Richard Biener CC: gcc-patches , Jakub Jelinek References: <4250958d-f7bf-1a0a-31d2-63eff191b258@codesourcery.com> From: Tobias Burnus Message-ID: <0e22d8c5-1008-cad4-c131-57ee3950a73a@codesourcery.com> Date: Wed, 23 Sep 2020 16:23:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------0FF76CF73BE5E0070B490B75" Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Sep 2020 14:23:51 -0000 --------------0FF76CF73BE5E0070B490B75 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable On 9/23/20 3:10 PM, Richard Biener wrote: > On Wed, 23 Sep 2020, Richard Biener wrote: >> LTRANS usually makes the symbols hidden, not local. Could also be =E2=80=93 whatever the 'nm' output means. >> So are you >> sure this isn't a target bug (hidden symbols not implemented >> but the host compiler obviously having checked that but assuming >> the target behaves the same as the host) or a linker bug? Unlikely, I assume the Linux x86-64 linker is rather well tested. As written this is the host =E2=80=93 just the offloading symbol table is device specific. > See lto/lto-partition.c:promote_symbol btw. Thanks for the pointer; it pointed me to node->externally_visible, which does the trick :-) Thus, next try =E2=80=93 which a patch I like much better! Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstra=C3=9Fe 201, 80634 M=C3=BCnch= en / Germany Registergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas = Heurung, Alexander Walter --------------0FF76CF73BE5E0070B490B75 Content-Type: text/x-patch; charset="UTF-8"; name="lto-offload.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="lto-offload.diff" LTO: Force externally_visible for offload_vars/funcs (PR97179) gcc/ChangeLog: PR lto/97179 * lto-cgraph.c (input_offload_tables): diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 93a99f3465b..1fb608705eb 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -1793,7 +1793,11 @@ input_offload_tables (bool do_force_output) may be no refs from the parent function to child_fn in offload LTO mode. */ if (do_force_output) - cgraph_node::get (fn_decl)->mark_force_output (); + { + cgraph_node *node = cgraph_node::get (fn_decl); + node->force_output = 1; + node->externally_visible = 1; + } } else if (tag == LTO_symtab_variable) { @@ -1804,7 +1808,11 @@ input_offload_tables (bool do_force_output) /* Prevent IPA from removing var_decl as unused, since there may be no refs to var_decl in offload LTO mode. */ if (do_force_output) - varpool_node::get (var_decl)->force_output = 1; + { + varpool_node *node = varpool_node::get (var_decl); + node->force_output = 1; + node->externally_visible = 1; + } } else fatal_error (input_location, --------------0FF76CF73BE5E0070B490B75--