diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2023-01-19 18:24:50 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2023-01-19 21:53:02 +0100 |
commit | 05a2d7a8b3277b469e7cb121115bba398adc8559 (patch) | |
tree | 20f5c508d1a5d65bca69de98ba41263a8f935c53 /newlib/libc | |
parent | 29b137af8098fa63b824072e1ce33883275959a3 (diff) | |
download | newlib-05a2d7a8b3277b469e7cb121115bba398adc8559.zip newlib-05a2d7a8b3277b469e7cb121115bba398adc8559.tar.gz newlib-05a2d7a8b3277b469e7cb121115bba398adc8559.tar.bz2 |
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.
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/machine/nvptx/_exit.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/newlib/libc/machine/nvptx/_exit.c b/newlib/libc/machine/nvptx/_exit.c index ae434c9..f2253df 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 (); + } } |