fix dead recursion when __NATIVE_USE_KLIB__ is defined

This commit is contained in:
Zihao Yu 2021-10-20 14:17:36 +08:00
parent a873515bde
commit f9b9b390fb
2 changed files with 16 additions and 2 deletions

View file

@ -30,7 +30,13 @@ int atoi(const char* nptr) {
}
void *malloc(size_t size) {
// On native, malloc() will be called during initializaion of C runtime.
// Therefore do not call panic() here, else it will yield a dead recursion:
// panic() -> putchar() -> (glibc) -> malloc() -> panic()
#if !(defined(__ISA_NATIVE__) && defined(__NATIVE_USE_KLIB__))
panic("Not implemented");
#endif
return NULL;
}
void free(void *ptr) {