From c74d8bb6028ec1d16aef04f7ae4cbc6bca34a044 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 22 Apr 2023 10:12:09 +0200 Subject: Fixed and improved __cxa_atexit handling --- src/wrapped/wrappedlibc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/wrapped') diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 6f617fca..0e87ca92 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -447,8 +447,7 @@ void EXPORT my___gmon_start__(x64emu_t *emu) int EXPORT my___cxa_atexit(x64emu_t* emu, void* p, void* a, void* dso_handle) { - (void)dso_handle; - AddCleanup1Arg(emu, p, a); + AddCleanup1Arg(emu, p, a, dso_handle); return 0; } void EXPORT my___cxa_finalize(x64emu_t* emu, void* p) @@ -462,7 +461,7 @@ void EXPORT my___cxa_finalize(x64emu_t* emu, void* p) } int EXPORT my_atexit(x64emu_t* emu, void *p) { - AddCleanup(emu, p); + AddCleanup(emu, p, NULL); // should grab current dso_handle? return 0; } @@ -2197,7 +2196,10 @@ EXPORT void my__Jv_RegisterClasses() {} EXPORT int32_t my___cxa_thread_atexit_impl(x64emu_t* emu, void* dtor, void* obj, void* dso) { (void)emu; - printf_log(LOG_INFO, "Warning, call to __cxa_thread_atexit_impl(%p, %p, %p) ignored\n", dtor, obj, dso); + //printf_log(LOG_INFO, "Warning, call to __cxa_thread_atexit_impl(%p, %p, %p) ignored\n", dtor, obj, dso); + AddCleanup1Arg(emu, dtor, obj, dso); + return 0; + return 0; } -- cgit 1.4.1