diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-03 10:23:18 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-03 10:23:18 +0100 |
| commit | ae1739f33070b2733b5472723e8f449234bb2c6d (patch) | |
| tree | 8610e13dcc0518008f48c4ad09d6dd1c5bbd03d8 /src | |
| parent | cfc09e09653bb10589f9def34eb250bdb26007ba (diff) | |
| download | box64-ae1739f33070b2733b5472723e8f449234bb2c6d.tar.gz box64-ae1739f33070b2733b5472723e8f449234bb2c6d.zip | |
Improved dlsym wrapped function, will find more symbols from emulated libs
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/wrappedlibdl.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c index bffa666f..d7831740 100644 --- a/src/wrapped/wrappedlibdl.c +++ b/src/wrapped/wrappedlibdl.c @@ -422,9 +422,16 @@ void* my_dlsym(x64emu_t* emu, void *handle, void *symbol) return NULL; } } else { - // still usefull? + // for "self" dlopen // => look globably - if(GetGlobalSymbolStartEnd(my_context->maplib, rsymbol, &start, &end, NULL, -1, NULL, 0, NULL)) { + //look in main elf first + int found = 0; + if(ElfGetSymTabStartEnd(my_context->elfs[0], &start, &end, rsymbol)) + found = 1; + if(!found && GetSymTabStartEnd(my_context->maplib, rsymbol, &start, &end)) + //if(!found && GetGlobalSymbolStartEnd(my_context->maplib, rsymbol, &start, &end, NULL, -1, NULL, 0, NULL)) + found = 1; + if(found) { printf_dlsym(LOG_NEVER, "%p\n", (void*)start); pthread_mutex_unlock(&mutex); return (void*)start; |