public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]
Date: Fri, 20 Jan 2023 19:37:04 +0000 (GMT)	[thread overview]
Message-ID: <20230120193704.A0A28385840E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=05a2d7a8b3277b469e7cb121115bba398adc8559

commit 05a2d7a8b3277b469e7cb121115bba398adc8559
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Jan 19 18:24:50 2023 +0100

    nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]
    
    This is still not properly resolving <https://gcc.gnu.org/PR85463>
    '[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 @@
  */
 
 #include <unistd.h>
+#include <stdlib.h>
 
 /* 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 = status;
-  for (;;)
-    asm ("exit;" ::: "memory");
+    {
+      *__exitval_ptr = status;
+      for (;;)
+	asm ("exit;" ::: "memory");
+    }
+  else /* offloading */
+    {
+      /* Map to 'abort'; see <https://gcc.gnu.org/PR85463>
+	 '[nvptx] "exit" in offloaded region doesn't terminate process'.  */
+      abort ();
+    }
 }

                 reply	other threads:[~2023-01-20 19:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230120193704.A0A28385840E@sourceware.org \
    --to=tschwinge@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).