From f7c93b68d8fc62987b0c73e97cae5cc6ee31b269 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 30 Sep 2024 14:00:33 +0200 Subject: [BOX32] Fixed main Elf init not always called --- src/emu/x64run_private.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/emu') diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c index deba1a05..5cb8141f 100644 --- a/src/emu/x64run_private.c +++ b/src/emu/x64run_private.c @@ -146,6 +146,14 @@ int32_t EXPORT my32___libc_start_main(x64emu_t* emu, int *(main) (int, char * *, if(emu->error) // any error, don't bother with more return 0; emu->quit = 0; + } else { + if(my_context->elfs[0]) { + printf_dump(LOG_DEBUG, "Calling init from main elf\n"); + RunElfInit(my_context->elfs[0], emu); + } + } + if(my_context->elfs[0]) { + MarkElfInitDone(my_context->elfs[0]); } printf_log(LOG_DEBUG, "Transfert to main(%d, %p, %p)=>%p from __libc_start_main\n", my_context->argc, my_context->argv, my_context->envv, main); // call main and finish -- cgit 1.4.1