about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedldlinux.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-26 19:22:53 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-26 19:22:53 +0100
commit13404ed090453ffa1a2b475b004b74db7086ff74 (patch)
tree9d1fb5cbad4f90ce1dcd2df7f7220b6dea6d4755 /src/wrapped/wrappedldlinux.c
parentff6cc844821439a8f50b68b27e6f1ac5264579c8 (diff)
downloadbox64-13404ed090453ffa1a2b475b004b74db7086ff74.tar.gz
box64-13404ed090453ffa1a2b475b004b74db7086ff74.zip
Added ability to staticaly build box64 (for #1045 and #310, maybe a few others tickets)
Diffstat (limited to 'src/wrapped/wrappedldlinux.c')
-rw-r--r--src/wrapped/wrappedldlinux.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c
index 83245e93..90ec1b23 100644
--- a/src/wrapped/wrappedldlinux.c
+++ b/src/wrapped/wrappedldlinux.c
@@ -34,14 +34,25 @@ void stSetup(box64context_t* context)
     my___libc_stack_end = context->stack;   // is this the end, or should I add stasz?
 }
 
+#ifdef STATICBUILD
+#include <link.h>
+extern void* __libc_enable_secure;
+extern void* __stack_chk_guard;
+//extern void* __pointer_chk_guard;
+//extern void* _rtld_global;
+//extern void* _rtld_global_ro;
+#endif
+
 // 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
 
+#ifndef STATICBUILD
 #define PRE_INIT\
     if(1)                                                           \
         lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);    \
     else
+#endif
 
 #define CUSTOM_INIT         \
     stSetup(box64);         \