Skip to content

Commit f0cf846

Browse files
committed
Cleanup
1 parent 0e7f9d6 commit f0cf846

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

runtime/libc.c

+21-10
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
#include <stdlib.h>
1010
#include <string.h>
1111

12-
void* calloc( size_t num, size_t size ) {
12+
void *calloc(size_t num, size_t size) {
1313
void *ptr = m_malloc(num * size);
1414
// memory already cleared by conservative GC
1515
return ptr;
1616
}
1717

18-
void free( void *ptr ) {
18+
void free(void *ptr) {
1919
m_free(ptr);
2020
}
2121

22-
void *realloc( void *ptr, size_t new_size ) {
22+
void *realloc(void *ptr, size_t new_size) {
2323
return m_realloc(ptr, new_size);
2424
}
2525

@@ -54,18 +54,29 @@ int strncmp(const char *_l, const char *_r, size_t n) {
5454
return *l - *r;
5555
}
5656

57-
void abort() {
57+
int errno;
58+
59+
int *__errno(void) {
60+
return &errno;
61+
}
62+
63+
int *__errno_location(void) {
64+
return &errno;
65+
}
66+
67+
__attribute__ ((noreturn))
68+
void abort(void) {
5869
mp_printf(&mp_plat_print, "Aborting\n");
5970
__builtin_trap();
6071
for(;;) {} // Should not reach here
6172
}
6273

63-
#if defined(__ARM_EABI__)
64-
int __aeabi_idiv0(int ret) {
65-
return ret;
74+
__attribute__ ((noreturn))
75+
void __stack_chk_fail(void) {
76+
abort();
6677
}
6778

68-
long long __aeabi_ldiv0(long long ret) {
69-
return ret;
79+
__attribute__ ((noreturn))
80+
void __stack_chk_fail_local(void) {
81+
abort();
7082
}
71-
#endif

0 commit comments

Comments
 (0)