about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibdl.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-07-09 11:58:35 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-07-09 11:58:35 +0200
commitec3786f86295b0fb769970bcb3c77b4ffffd7d48 (patch)
treeeeda9ecd7394e93eac2f759786ac3f7c19a1334b /src/wrapped/wrappedlibdl.c
parent0e761801deb4aa045e6052dee454973587e8dd4b (diff)
downloadbox64-ec3786f86295b0fb769970bcb3c77b4ffffd7d48.tar.gz
box64-ec3786f86295b0fb769970bcb3c77b4ffffd7d48.zip
Various improvement and some workaround to support musl binary (for #324)
Diffstat (limited to 'src/wrapped/wrappedlibdl.c')
-rwxr-xr-xsrc/wrapped/wrappedlibdl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c
index d8582536..903c2b9e 100755
--- a/src/wrapped/wrappedlibdl.c
+++ b/src/wrapped/wrappedlibdl.c
@@ -62,7 +62,7 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag)
     library_t *lib = NULL;
     dlprivate_t *dl = my_context->dlprivate;
     size_t dlopened = 0;
-    int is_local = (flag&0x100)?0:1;  // if not global, then local, and that means symbols are not put in the global "pot" for pther libs
+    int is_local = (flag&0x100)?0:1;  // if not global, then local, and that means symbols are not put in the global "pot" for other libs
     CLEARERR
     if(filename) {
         char* rfilename = (char*)alloca(MAX_PATH);
@@ -138,7 +138,7 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag)
         // Then open the lib
         const char* libs[] = {rfilename};
         my_context->deferedInit = 1;
-        int bindnow = (flag&0x2)?1:0;
+        int bindnow = (!box64_musl && (flag&0x2))?1:0;
         if(AddNeededLib(NULL, NULL, NULL, is_local, bindnow, libs, 1, emu->context, emu)) {
             printf_log(LOG_INFO, "Warning: Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag);
             if(!dl->last_error)
@@ -553,5 +553,9 @@ int my_dlinfo(x64emu_t* emu, void* handle, int request, void* info)
     return -1;
 }
 
+#define CUSTOM_INIT\
+    setNeededLibs(lib, 1, "libc.so.6");
+
+
 // define all standard library functions
 #include "wrappedlib_init.h"