Skip to content

Commit c145777

Browse files
authored
wut_newlib: Implement __syscall_abort and __syscall_assert_func (#359)
1 parent e9abab7 commit c145777

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

libraries/wutnewlib/wut_newlib.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
void(*__wut_exit)(int rc);
99
extern void __fini_wut(void);
1010

11-
void __attribute__((weak))
12-
abort(void) {
11+
void
12+
__wut__abort(void) {
1313
const char *error_text = "Abort called.\n";
1414
if (OSIsDebuggerPresent()) {
1515
__asm__ __volatile__("mr 3, %0\n" // load 'tmp' into r3
@@ -23,8 +23,8 @@ abort(void) {
2323
while (1);
2424
}
2525

26-
void __attribute__((weak))
27-
__assert_func(const char *file,
26+
void
27+
__wut__assert_func(const char *file,
2828
int line,
2929
const char *func,
3030
const char *failedexpr)
@@ -63,15 +63,6 @@ __assert_func(const char *file,
6363
while (1);
6464
}
6565

66-
void __attribute__((weak))
67-
__assert(const char *file,
68-
int line,
69-
const char *failedexpr)
70-
{
71-
__assert_func(file, line, NULL, failedexpr);
72-
/* NOTREACHED */
73-
}
74-
7566
void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr) {
7667
return __wut_sbrk_r(ptr, incr);
7768
}
@@ -144,6 +135,14 @@ int __syscall_clock_getres(clockid_t clock_id, struct timespec *res) {
144135
return __wut_clock_getres(clock_id, res);
145136
}
146137

138+
void __syscall_abort() {
139+
__wut__abort();
140+
}
141+
142+
void __syscall_assert_func(const char *file, int line, const char *func, const char *failedexpr) {
143+
__wut__assert_func(file, line, func, failedexpr);
144+
}
145+
147146
void
148147
__init_wut_newlib()
149148
{

0 commit comments

Comments
 (0)