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 = status; - for (;;) - asm ("exit;" ::: "memory"); + { + *__exitval_ptr = status; + for (;;) + asm ("exit;" ::: "memory"); + } + else /* offloading */ + { + /* Map to 'abort'; see + '[nvptx] "exit" in offloaded region doesn't terminate process'. */ + abort (); + } }