From ca9bc1361943575724eb5152798aa208ed5eed6c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 8 Jul 2023 18:01:51 +0200 Subject: Better wrapping for __libc_stack_end symbol --- src/wrapped/wrappedldlinux.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/wrapped/wrappedldlinux.c') 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" -- cgit 1.4.1