diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-04-15 15:31:51 -0700 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2015-04-15 16:24:21 -0700 |
commit | 163ab8ba86deb991c73152e6828f270cc71dc4c5 (patch) | |
tree | fdaf88cdc6ae4788a95f2f527e35fa869398397f /libc | |
parent | 8f3f04184a5772b421867b59acd3d0dfbc6fa4eb (diff) | |
download | android_bionic-163ab8ba86deb991c73152e6828f270cc71dc4c5.tar.gz android_bionic-163ab8ba86deb991c73152e6828f270cc71dc4c5.tar.bz2 android_bionic-163ab8ba86deb991c73152e6828f270cc71dc4c5.zip |
Call __cxa_thread_finalize for the main thread.
Bug: http://b/20231984
Bug: http://b/16696563
Change-Id: I71cfddd0d404d1d4a593ec8d3bca9741de8cb90f
Diffstat (limited to 'libc')
-rw-r--r-- | libc/Android.mk | 2 | ||||
-rw-r--r-- | libc/stdlib/exit.c (renamed from libc/upstream-openbsd/lib/libc/stdlib/exit.c) | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/libc/Android.mk b/libc/Android.mk index e632ee72f..0dc3db770 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -63,6 +63,7 @@ libc_common_src_files := \ stdio/sprintf.c \ stdio/stdio.c \ stdio/stdio_ext.cpp \ + stdlib/exit.c \ # Fortify implementations of libc functions. libc_common_src_files += \ @@ -480,7 +481,6 @@ libc_upstream_openbsd_ndk_src_files := \ upstream-openbsd/lib/libc/stdlib/atoi.c \ upstream-openbsd/lib/libc/stdlib/atol.c \ upstream-openbsd/lib/libc/stdlib/atoll.c \ - upstream-openbsd/lib/libc/stdlib/exit.c \ upstream-openbsd/lib/libc/stdlib/getenv.c \ upstream-openbsd/lib/libc/stdlib/insque.c \ upstream-openbsd/lib/libc/stdlib/lsearch.c \ diff --git a/libc/upstream-openbsd/lib/libc/stdlib/exit.c b/libc/stdlib/exit.c index 83fe3d2de..10ce674ab 100644 --- a/libc/upstream-openbsd/lib/libc/stdlib/exit.c +++ b/libc/stdlib/exit.c @@ -32,8 +32,6 @@ #include <sys/mman.h> #include <stdlib.h> #include <unistd.h> -#include "atexit.h" -#include "thread_private.h" /* * This variable is zero until a process has created a thread. @@ -44,12 +42,21 @@ */ int __isthreaded = 0; +/* BEGIN android-added: using __cxa_finalize and __cxa_thread_finalize */ +extern void __cxa_finalize(void* dso_handle); +extern void __cxa_thread_finalize(); +/* END android-added */ + /* * Exit, flushing stdio buffers if necessary. */ void exit(int status) { + /* BEGIN android-added: call thread_local d-tors */ + __cxa_thread_finalize(); + /* END android-added */ + /* * Call functions registered by atexit() or _cxa_atexit() * (including the stdio cleanup routine) and then _exit(). |