From f474c88130316b865151dd2b273ebb15d4149fd1 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 15 Oct 2017 08:33:32 -0500 Subject: malloc: add __libc_{m,c,re}alloc and __libc_free aliases --- libgcompat/malloc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 /* memset */ +#include /* {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"))); + -- cgit v1.2.3-70-g09d2