about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedtbbmallocproxy.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-29 22:32:47 +0200
committerGitHub <noreply@github.com>2022-10-29 22:32:47 +0200
commit0e47d1269cc660d2b1451e76375b2d3545ce66f4 (patch)
tree27c958e5ef3cd147625112a82626624d51fd6fe5 /src/wrapped/wrappedtbbmallocproxy.c
parent7dc5359c2b10521696e7d251627eff029d53ee28 (diff)
downloadbox64-0e47d1269cc660d2b1451e76375b2d3545ce66f4.tar.gz
box64-0e47d1269cc660d2b1451e76375b2d3545ce66f4.zip
Malloc override (#437)
* Add some malloc override mecanism, but missing c++ function overriding
* Add c++ new/delete redirection too
* Added support for libtbbmalloc_proxy
Diffstat (limited to 'src/wrapped/wrappedtbbmallocproxy.c')
-rw-r--r--src/wrapped/wrappedtbbmallocproxy.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wrapped/wrappedtbbmallocproxy.c b/src/wrapped/wrappedtbbmallocproxy.c
new file mode 100644
index 00000000..af95d93b
--- /dev/null
+++ b/src/wrapped/wrappedtbbmallocproxy.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "wrapper.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+
+// Fake the lib for now, don't load it
+const char* tbbmallocproxyName = "libtbbmalloc_proxy.so.2";
+#define LIBNAME tbbmallocproxy
+
+// this preinit basically open "box64" as dlopen
+#define PRE_INIT\
+    lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);    \
+    if(0)
+
+#include "wrappedlib_init.h"