wut_newlib: Implement __syscall_abort and __syscall_assert_func (#359)

This commit is contained in:
Maschell 2024-04-22 20:05:00 +02:00 committed by GitHub
parent e9abab7cd4
commit c1457779be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,8 +8,8 @@
void(*__wut_exit)(int rc);
extern void __fini_wut(void);
void __attribute__((weak))
abort(void) {
void
__wut__abort(void) {
const char *error_text = "Abort called.\n";
if (OSIsDebuggerPresent()) {
__asm__ __volatile__("mr 3, %0\n" // load 'tmp' into r3
@ -23,8 +23,8 @@ abort(void) {
while (1);
}
void __attribute__((weak))
__assert_func(const char *file,
void
__wut__assert_func(const char *file,
int line,
const char *func,
const char *failedexpr)
@ -63,15 +63,6 @@ __assert_func(const char *file,
while (1);
}
void __attribute__((weak))
__assert(const char *file,
int line,
const char *failedexpr)
{
__assert_func(file, line, NULL, failedexpr);
/* NOTREACHED */
}
void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr) {
return __wut_sbrk_r(ptr, incr);
}
@ -144,6 +135,14 @@ int __syscall_clock_getres(clockid_t clock_id, struct timespec *res) {
return __wut_clock_getres(clock_id, res);
}
void __syscall_abort() {
__wut__abort();
}
void __syscall_assert_func(const char *file, int line, const char *func, const char *failedexpr) {
__wut__assert_func(file, line, func, failedexpr);
}
void
__init_wut_newlib()
{