diff options
Diffstat (limited to 'libgcompat')
-rw-r--r-- | libgcompat/malloc.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libgcompat/malloc.c b/libgcompat/malloc.c index 3a5818c..b90bd81 100644 --- a/libgcompat/malloc.c +++ b/libgcompat/malloc.c @@ -24,6 +24,7 @@ */ #include <string.h> /* memset */ +#include <stdlib.h> /* {m,c,re}alloc, free */ struct mallinfo { int arena; /* Non-mmapped space allocated (bytes) */ @@ -44,3 +45,29 @@ struct mallinfo mallinfo(void) memset(&my_info, 0, sizeof(struct mallinfo)); return my_info; } + +void *__libc_malloc(size_t size) +{ + return malloc(size); +} + +void __libc_free(void *ptr) +{ + return free(ptr); +} + +void *__libc_calloc(size_t nmemb, size_t size) +{ + return calloc(nmemb, size); +} + +void *__libc_realloc(void *ptr, size_t size) +{ + return realloc(ptr, size); +} + +extern __typeof(__libc_malloc) __malloc __attribute__((weak, alias("__libc_malloc"))); +extern __typeof(__libc_calloc) __calloc __attribute__((weak, alias("__libc_calloc"))); +extern __typeof(__libc_realloc) __realloc __attribute__((weak, alias("__libc_realloc"))); +extern __typeof(__libc_free) __free __attribute__((weak, alias("__libc_free"))); + |