diff options
Diffstat (limited to 'src/main.c')
| -rwxr-xr-x | src/main.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index b942f978..a8b0cff3 100755 --- a/src/main.c +++ b/src/main.c @@ -1701,12 +1701,19 @@ int main(int argc, const char **argv, char **env) { AddMainElfToLinkmap(elf_header); // pre-load lib if needed if(ld_preload.size) { - my_context->preload = new_neededlib(ld_preload.size); - for(int i=0; i<ld_preload.size; ++i) - my_context->preload->names[i] = ld_preload.paths[i]; - if(AddNeededLib(my_context->maplib, 0, 0, my_context->preload, my_context, emu)) { - printf_log(LOG_INFO, "Warning, cannot pre-load of the libs\n"); - } + my_context->preload = new_neededlib(0); + for(int i=0; i<ld_preload.size; ++i) { + needed_libs_t* tmp = new_neededlib(1); + tmp->names[0] = ld_preload.paths[i]; + if(AddNeededLib(my_context->maplib, 0, 0, tmp, my_context, emu)) { + printf_log(LOG_INFO, "Warning, cannot pre-load of %s\n", tmp->names[0]); + RemoveNeededLib(my_context->maplib, 0, tmp, my_context, emu); + } else { + for(int j=0; j<tmp->size; ++j) + add1lib_neededlib(my_context->preload, tmp->libs[j], tmp->names[j]); + free_neededlib(tmp); + } + } } FreeCollection(&ld_preload); // Call librarian to load all dependant elf |