From 1a87c1eae23a987dbc5a99af80bf28a4e152476d Mon Sep 17 00:00:00 2001 From: Yann MAGNIN Date: Sun, 12 May 2024 12:47:31 +0200 Subject: [PATCH] exposes `_exit()` as an alias to `_Exit()` to support the libSSP with GGC 14.1 --- CMakeLists.txt | 2 ++ include/unistd.h | 4 ++++ src/unistd/_exit.c | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 src/unistd/_exit.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 7852235..06c9b7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,6 +190,8 @@ set(SOURCES src/stdlib/strtoll.c src/stdlib/strtoul.c src/stdlib/strtoull.c + # unistd + src/unistd/_exit.c # string src/string/memchr.c src/string/memcmp.c diff --git a/include/unistd.h b/include/unistd.h index faf2394..886fa4f 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -45,6 +45,10 @@ extern char *getcwd(char *__buf, size_t __size); extern int chdir(char const *__path); +/* Exit immediately, bypassing exit handlers or signal handlers. */ +__attribute__((noreturn)) +extern void _exit(int __status); + /* Kernel-style functions supported only by Vhex. */ diff --git a/src/unistd/_exit.c b/src/unistd/_exit.c new file mode 100644 index 0000000..c7199fa --- /dev/null +++ b/src/unistd/_exit.c @@ -0,0 +1,4 @@ +#include + +/* Exit immediately, bypassing exit handlers or signal handlers. */ +void _exit(int status) __attribute__((alias("_Exit")));