about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-11-01 10:37:44 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-11-01 10:37:44 +0100
commit24cc0c8422f4917fc8d0d03044d930ee91163674 (patch)
treeaa36455ad4889d1d1a72cc7fd27e256d7e375c64 /src/wrapped
parent8459ea0d31a851e847318273233c9a8b2b079eae (diff)
downloadbox64-24cc0c8422f4917fc8d0d03044d930ee91163674.tar.gz
box64-24cc0c8422f4917fc8d0d03044d930ee91163674.zip
Detect when program is linked with glibc 2.34+ to workaround the default libc libs to load
Diffstat (limited to 'src/wrapped')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c16
-rwxr-xr-xsrc/wrapped/wrappedlibdl.c2
2 files changed, 13 insertions, 5 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 690fa66f..8f8f3881 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -2964,10 +2964,18 @@ EXPORT char my___libc_single_threaded = 0;
     my___progname = my_program_invocation_short_name =                          \
         strrchr(box64->argv[0], '/') + 1;                                       \
     getMy(lib);                                                                 \
-    setNeededLibs(lib, 3,                                                       \
-        "ld-linux-x86-64.so.2",                                                 \
-        "libpthread.so.0",                                                      \
-        "librt.so.1");
+    if(box64_isglibc234)                                                        \
+        setNeededLibs(lib, 5,                                                   \
+            "ld-linux-x86-64.so.2",                                             \
+            "libpthread.so.0",                                                  \
+            "libdl.so.2",                                                       \
+            "libutil.so.1",                                                     \
+            "librt.so.1");                                                      \
+    else                                                                        \
+        setNeededLibs(lib, 3,                                                   \
+            "ld-linux-x86-64.so.2",                                             \
+            "libpthread.so.0",                                                  \
+            "librt.so.1");
 
 #define CUSTOM_FINI \
     freeMy();
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c
index 3a6d505d..4cd70df4 100755
--- a/src/wrapped/wrappedlibdl.c
+++ b/src/wrapped/wrappedlibdl.c
@@ -474,7 +474,7 @@ int my_dlinfo(x64emu_t* emu, void* handle, int request, void* info)
 }
 
 #define CUSTOM_INIT\
-    setNeededLibs(lib, 1, "libc.so.6");
+    if(!box64_isglibc234) setNeededLibs(lib, 1, "libc.so.6");
 
 
 // define all standard library functions