Skip to content

Commit

Permalink
libc: minimal: Implement abort().
Browse files Browse the repository at this point in the history
abort() is an important runtime function, oftentimes used to signal
abnormal execution conditions in generic applications. Worse, they
may be used under such circumstances in e.g. compiler support
libraries, in which case lack of implementation of this function
will lead to link error.

Fixes: zephyrproject-rtos#29541

Signed-off-by: Paul Sokolovsky <[email protected]>
  • Loading branch information
pfalcon committed Oct 28, 2020
1 parent d3a8562 commit 24a2725
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/libc/minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ zephyr_system_include_directories(include)

zephyr_library()
zephyr_library_sources(
source/stdlib/abort.c
source/stdlib/atoi.c
source/stdlib/strtol.c
source/stdlib/strtoul.c
Expand Down
1 change: 1 addition & 0 deletions lib/libc/minimal/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static inline void exit(int status)
{
_exit(status);
}
void abort(void);

int rand(void);

Expand Down
14 changes: 14 additions & 0 deletions lib/libc/minimal/source/stdlib/abort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2020 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdlib.h>
#include <zephyr.h>

void abort(void)
{
printk("abort()\n");
k_panic();
}

0 comments on commit 24a2725

Please sign in to comment.