summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2017-10-15 08:33:32 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2017-10-15 08:33:32 -0500
commitf474c88130316b865151dd2b273ebb15d4149fd1 (patch)
tree195245159a5d1fc322a132473d255a9f92f19f0d /libgcompat
parent48621083e37dcce18e017e840d79e668b5b380de (diff)
downloadgcompat-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.c27
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")));
+