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.
This commit is contained in:
parent
29b137af80
commit
05a2d7a8b3
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Sadly, PTX doesn't support weak declarations, only weak
|
/* Sadly, PTX doesn't support weak declarations, only weak
|
||||||
definitions. Weakly define it here in case we're not using crt0
|
definitions. Weakly define it here in case we're not using crt0
|
||||||
|
@ -26,7 +27,15 @@ void __attribute__((noreturn))
|
||||||
_exit (int status)
|
_exit (int status)
|
||||||
{
|
{
|
||||||
if (__exitval_ptr)
|
if (__exitval_ptr)
|
||||||
|
{
|
||||||
*__exitval_ptr = status;
|
*__exitval_ptr = status;
|
||||||
for (;;)
|
for (;;)
|
||||||
asm ("exit;" ::: "memory");
|
asm ("exit;" ::: "memory");
|
||||||
|
}
|
||||||
|
else /* offloading */
|
||||||
|
{
|
||||||
|
/* Map to 'abort'; see <https://gcc.gnu.org/PR85463>
|
||||||
|
'[nvptx] "exit" in offloaded region doesn't terminate process'. */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue