From: Willy Tarreau Date: Mon, 7 Feb 2022 16:23:54 +0000 (+0100) Subject: tools/nolibc/stdlib: implement abort() X-Git-Tag: v6.1-rc5~1369^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0f04f28d5ae483b3b354cb3b63a3bab0b00cee4;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Paul E. McKenney --- diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h index b46bebd..733105c 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) {