summaryrefslogtreecommitdiff
path: root/tools/include/nolibc
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2022-02-07 19:23:54 +0300
committerPaul E. McKenney <paulmck@kernel.org>2022-04-21 03:05:45 +0300
commitf0f04f28d5ae483b3b354cb3b63a3bab0b00cee4 (patch)
tree00c64c7796ae656d585305f41039aca1d73dcfbb /tools/include/nolibc
parentc4486e97283d0b3d72a8eeda91e53e2ea9b62fbe (diff)
downloadlinux-f0f04f28d5ae483b3b354cb3b63a3bab0b00cee4.tar.xz
tools/nolibc/stdlib: implement abort()
libgcc uses it for certain divide functions, so it must be exported. Like for memset() we do that in its own section so that the linker can strip it when not needed. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/include/nolibc')
-rw-r--r--tools/include/nolibc/stdlib.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h
index b46bebd48ba2..733105c574ee 100644
--- a/tools/include/nolibc/stdlib.h
+++ b/tools/include/nolibc/stdlib.h
@@ -23,6 +23,14 @@ static __attribute__((unused)) char itoa_buffer[21];
* As much as possible, please keep functions alphabetically sorted.
*/
+/* must be exported, as it's used by libgcc for various divide functions */
+__attribute__((weak,unused,noreturn,section(".text.nolibc_abort")))
+void abort(void)
+{
+ sys_kill(sys_getpid(), SIGABRT);
+ for (;;);
+}
+
static __attribute__((unused))
long atol(const char *s)
{