From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id A0A28385840E; Fri, 20 Jan 2023 19:37:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0A28385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674243424; bh=HgPgzdCXxXzoU8Bz6eOYlzSRqwzQY4sARPdTnM79dPE=; h=From:To:Subject:Date:From; b=T8nvsFvht12k+QHMbEIL20t+2F9/ahi0V9YWvTZpJvWcUsnDl63o/FCWtpOKMHZAJ BnPRYzEOUdtgON+oaq76UIDDSY+lPN6zyKZAhRkyA3RN2dM965Kzdl3uE+akO77SJg A34FeIItLU+K2tZCSKk4N3g+kMNo6109TEgP9C7c= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Thomas Schwinge To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463] X-Act-Checkin: newlib-cygwin X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 29b137af8098fa63b824072e1ce33883275959a3 X-Git-Newrev: 05a2d7a8b3277b469e7cb121115bba398adc8559 Message-Id: <20230120193704.A0A28385840E@sourceware.org> Date: Fri, 20 Jan 2023 19:37:04 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D05a2d7a8b32= 77b469e7cb121115bba398adc8559 commit 05a2d7a8b3277b469e7cb121115bba398adc8559 Author: Thomas Schwinge Date: Thu Jan 19 18:24:50 2023 +0100 nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463] =20 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. Diff: --- 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 @@ */ =20 #include +#include =20 /* 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 (); + } }