From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id C2BD4398E478 for ; Wed, 23 Sep 2020 12:54:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C2BD4398E478 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: FSA5QHKiVB7FK/9QRukXKwLX5mmTLiAyorQsZC2NYfCjDemAdGk0WP4SzWe5EtCoPLOuKcRJUr lFxsPrUTl8yuy2HeJJD0HI3/tiRzGRmthHTIvrpyvQ3JastX2kKHTqP3N5vlc0WaOCCw/XYSxV nqiHYrX7HO4ns3oJsM1QTP6/xTVYiosX5ZSnoIbNMiFR+Wcih6p7kqpkx8NgyaW/e1fIZghYMl rjn4Fhtf7Z+wxCvpoJw3fQT35IeaJQBXTHe4Yn5zZJQLGnipOVHAaI+ViyP3Qr+gax/xDtFk97 RX4= X-IronPort-AV: E=Sophos;i="5.77,293,1596528000"; d="diff'?scan'208";a="53171725" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 23 Sep 2020 04:54:20 -0800 IronPort-SDR: Q13JQ757hGINjZT5vnCQ8Qraugn6UGawOIo85dQD1ZGLO5Pa8A6DASb1EP3zaz4e1qbmL/l+xQ w3jn7hne3VFim3Mvmk37eAIjtkqUYd8hmWbr0o/XiG+dqklqefSEjy+1tuT0cvbBVBqevwTZS3 Tc9IUN1W+X9F2ZTCgFdMn28zpZC1hS5S2CKGEbwr1hmZf1FLBuvlKatpvZBZtBSoNsa+/eF0t6 jqjQfpulqCL8lkHF7mvuMOZ2cETodmblVTM0FdzQoxnQ8lD7HgmFYyO/GkW9c12as8A/g3UnoF iuk= To: gcc-patches , Jakub Jelinek , Richard Biener From: Tobias Burnus Subject: [Patch] lto-wrapper.c: Use -flto-partition=none with offloading (PR97179) Message-ID: <4250958d-f7bf-1a0a-31d2-63eff191b258@codesourcery.com> Date: Wed, 23 Sep 2020 14:53:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------10829EE842561DD92724932D" Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) 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 12:54:23 -0000 --------------10829EE842561DD92724932D Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable (Pre-remark: the following applies to the host; the offloading is only involved as otherwise the (.gnu.)offload_{vars,funcs} global variable/table wouldn't exist.) Due to partitioning, it can happen that the offloading table and the functions and variables (which it contains as pointer), end up in different ltrans. As the functions and vars end up as local symbols =E2=80=93 the linker will not associate the entries in the table of one ltrans with the symbol from the other ltrans, failing with "undefined reference" errors. This could be fixed properly by either placing all vars/funcs referenced in the (.gnu.)offload_{vars,funcs} table in the same ltrans parition =E2=80=94 or by ensuring that those symbols are available. For funcs, the latter works by setting TREE_PUBLIC (cf. PR) =E2=80=93 but I didn't manage to do this for variables. =E2=80=94 Hence: This patch disables lto partitioning if the code has offloading. OK for mainline? =E2=80=94 Or better suggestions how to handle this? 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 --------------10829EE842561DD92724932D Content-Type: text/x-patch; charset="UTF-8"; name="lto-wrapper.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="lto-wrapper.diff" lto-wrapper.c: Use -flto-partition=none with offloading (PR97179) gcc/ChangeLog: PR lto/97179 * lto-wrapper.c (run_gcc): diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 82cfa6bd67e..027db8c5200 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1490,6 +1490,12 @@ run_gcc (unsigned argc, char *argv[]) case OPT_flto_partition_: if (strcmp (option->arg, "none") == 0) no_partition = true; + else if (have_offload) + { + /* PR lto/97179. */ + no_partition = true; + warning (0, "Ignoring %<-flto_partition%> as offloading is used"); + } break; case OPT_flto_: --------------10829EE842561DD92724932D--