about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-22 10:12:09 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-22 10:12:09 +0200
commitc74d8bb6028ec1d16aef04f7ae4cbc6bca34a044 (patch)
treee232c29f770a0506251360d671f387b37f40abba /src/wrapped
parentec7844072f5ad5a74de9f4a42c91aefc2f174691 (diff)
downloadbox64-c74d8bb6028ec1d16aef04f7ae4cbc6bca34a044.tar.gz
box64-c74d8bb6028ec1d16aef04f7ae4cbc6bca34a044.zip
Fixed and improved __cxa_atexit handling
Diffstat (limited to 'src/wrapped')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c10
1 files changed, 6 insertions, 4 deletions
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;
 }