about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedldlinux.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-07-08 18:01:51 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-07-08 18:01:51 +0200
commitca9bc1361943575724eb5152798aa208ed5eed6c (patch)
tree451d2f55ab2ba2f5650cdfa55f8c55c45067a342 /src/wrapped/wrappedldlinux.c
parent3f573711aab181f8310d8924edfe010e8a56e20a (diff)
downloadbox64-ca9bc1361943575724eb5152798aa208ed5eed6c.tar.gz
box64-ca9bc1361943575724eb5152798aa208ed5eed6c.zip
Better wrapping for __libc_stack_end symbol
Diffstat (limited to 'src/wrapped/wrappedldlinux.c')
-rwxr-xr-xsrc/wrapped/wrappedldlinux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c
index b5dc0da6..83245e93 100755
--- a/src/wrapped/wrappedldlinux.c
+++ b/src/wrapped/wrappedldlinux.c
@@ -28,6 +28,12 @@ EXPORT void* my___tls_get_addr(void* p)
     return ptr->data+GetTLSBase(my_context->elfs[t->i])+t->o;
 }
 
+EXPORT void* my___libc_stack_end;
+void stSetup(box64context_t* context)
+{
+    my___libc_stack_end = context->stack;   // is this the end, or should I add stasz?
+}
+
 // don't try to load the actual ld-linux (because name is variable), just use box64 itself, as it's linked to ld-linux
 const char* ldlinuxName = "ld-linux.so.2";
 #define LIBNAME ldlinux
@@ -37,6 +43,9 @@ const char* ldlinuxName = "ld-linux.so.2";
         lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);    \
     else
 
+#define CUSTOM_INIT         \
+    stSetup(box64);         \
+
 // define all standard library functions
 #include "wrappedlib_init.h"