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 E136A3858CDA for ; Thu, 19 Jan 2023 22:00:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E136A3858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.97,230,1669104000"; d="scan'208";a="97702083" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 19 Jan 2023 14:00:15 -0800 IronPort-SDR: BwY6gKL/oDXcPNwMUci8O3iW97cRYYGn71myl9Hpc5EV9GRjL2vI1KvrrcSVKzUZ6prqx1qiRJ o/FwdFE9UH6zwWhCXxX2K+TyyD1BOAAhSM8OVxNxBKG/3b2FtlgIKCV5jEjHl4WLIKfVNXqUM1 nkdvGQsDfMgXR0vGxMgCV89PuVLrttZZXAdCvpNBQ7hcnw1fbV9JvzXQV5vwbwe7LsonmOFRKd S4FGU31OPDMbyLez8fuWfxej0+r5E2V94BCDK6WNi+b7TPsEqFKoTX/+lmyyh2GauDJQY7N1dn pnc= From: Thomas Schwinge To: CC: , Thomas Schwinge Subject: [PATCH] nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463] Date: Thu, 19 Jan 2023 23:00:05 +0100 Message-ID: <20230119220005.2002779-1-thomas@codesourcery.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <87in8nsgz9.fsf@euler.schwinge.homeip.net> References: <87in8nsgz9.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is still not properly resolving '[nvptx] "exit" in offloaded region doesn't terminate process', but is one step into that direction, and allows for simplifying some GCC code. --- newlib/libc/machine/nvptx/_exit.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/newlib/libc/machine/nvptx/_exit.c b/newlib/libc/machine/nvptx/= _exit.c index ae434c930..f2253df66 100644 --- a/newlib/libc/machine/nvptx/_exit.c +++ b/newlib/libc/machine/nvptx/_exit.c @@ -14,6 +14,7 @@ */ #include +#include /* Sadly, PTX doesn't support weak declarations, only weak definitions. Weakly define it here in case we're not using crt0 @@ -26,7 +27,15 @@ void __attribute__((noreturn)) _exit (int status) { if (__exitval_ptr) - *__exitval_ptr =3D status; - for (;;) - asm ("exit;" ::: "memory"); + { + *__exitval_ptr =3D status; + for (;;) + asm ("exit;" ::: "memory"); + } + else /* offloading */ + { + /* Map to 'abort'; see + '[nvptx] "exit" in offloaded region doesn't terminate process'. *= / + abort (); + } } -- 2.25.1 ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=DFe 201, 8= 0634 M=FCnchen; Gesellschaft mit beschr=E4nkter Haftung; Gesch=E4ftsf=FChre= r: Thomas Heurung, Frank Th=FCrauf; Sitz der Gesellschaft: M=FCnchen; Regis= tergericht M=FCnchen, HRB 106955