about summary refs log tree commit diff stats
path: root/src/elfs/elfloader.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-06-04 12:01:58 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-06-04 12:01:58 +0200
commitf4c8c295107e0c1af7c3ef033d5880daca61992c (patch)
treeeee69db9c6833d7a9a26ec9715d2369163170b3d /src/elfs/elfloader.c
parent87be9fd1ad3c743bbc109e2e4e0bd79a04d83d14 (diff)
downloadbox64-f4c8c295107e0c1af7c3ef033d5880daca61992c.tar.gz
box64-f4c8c295107e0c1af7c3ef033d5880daca61992c.zip
[ELF_LOAD] Also use SONAME of loaded elf to match loaded libs (helps #805)
Diffstat (limited to 'src/elfs/elfloader.c')
-rwxr-xr-xsrc/elfs/elfloader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c
index 310bb2f7..e10de870 100755
--- a/src/elfs/elfloader.c
+++ b/src/elfs/elfloader.c
@@ -1184,9 +1184,13 @@ int LoadNeededLibs(elfheader_t* h, lib_t *maplib, int local, int bindnow, box64c
 
     DumpDynamicNeeded(h);
     int cnt = 0;
-    for (int i=0; i<h->numDynamic; ++i)
+    // count the number of needed libs, and also grab soname
+    for (int i=0; i<h->numDynamic; ++i) {
         if(h->Dynamic[i].d_tag==DT_NEEDED)
             ++cnt;
+        if(h->Dynamic[i].d_tag==DT_SONAME)
+            h->soname = h->DynStrTab+h->delta+h->Dynamic[i].d_un.d_val;
+    }
     h->needed = new_neededlib(cnt);
     if(h == my_context->elfs[0])
         my_context->neededlibs = h->needed;