diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-10-15 08:33:32 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-10-15 08:33:32 -0500 |
commit | f474c88130316b865151dd2b273ebb15d4149fd1 (patch) | |
tree | 195245159a5d1fc322a132473d255a9f92f19f0d /libgcompat | |
parent | 48621083e37dcce18e017e840d79e668b5b380de (diff) | |
download | gcompat-f474c88130316b865151dd2b273ebb15d4149fd1.tar.gz gcompat-f474c88130316b865151dd2b273ebb15d4149fd1.tar.bz2 gcompat-f474c88130316b865151dd2b273ebb15d4149fd1.tar.xz gcompat-f474c88130316b865151dd2b273ebb15d4149fd1.zip |
malloc: add __libc_{m,c,re}alloc and __libc_free aliases
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"))); + |