History log of /bionic/libc/bionic/__cxa_thread_atexit_impl.cpp
Revision Date Author Comments
42d949ff9d2956e25f84e537f43a8f93ecb37baf 07-Jan-2016 Elliott Hughes <enh@google.com> Defend against -fstack-protector in libc startup.

Exactly which functions get a stack protector is up to the compiler, so
let's separate the code that sets up the environment stack protection
requires and explicitly build it with -fno-stack-protector.

Bug: http://b/26276517
Change-Id: I8719e23ead1f1e81715c32c1335da868f68369b5
952e9eb0866bc2061b671e8d6c90cae275eda6bd 25-Nov-2015 Yabin Cui <yabinc@google.com> Don't use __thread in __cxa_thread_finalize().

Currently we use __thread variable to store thread_local_dtors,
which makes tsan test fork_atexit.cc hang. The problem is as below:
The main thread creates a worker thread, the worker thread calls
pthread_exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init) -> emutls_init().
Then the main thread calls fork(), the child process cals
exit() -> __cxa_thread_finalize() -> __emutls_get_address()
-> pthread_once(emutls_init).
So the child process is waiting for pthread_once(emutls_init)
to finish which will never occur.

It might be the test's fault because POSIX standard says if a
multi-threaded process calls fork(), the new process may only
execute async-signal-safe operations until exec functions are
called. And exit() is not async-signal-safe. But we can make
bionic more reliable by not using __thread in
__cxa_thread_finalize().

Bug: 25392375
Change-Id: Ife403dd7379dad8ddf1859c348c1c0adea07afb3
66aa0b61f736678e97a0cfaf975052881a23651b 15-Apr-2015 Dmitriy Ivanov <dimitry@google.com> Hide emutls* symbols in libc.so

Also make thread_local in test static to avoid ld.bfd
warning for arm64.

Change-Id: I09a3f2aa9b73a4fafa3f3bbc64ddc2a128ad50ee
df79c330d895af31f39ee301dee62731fa586168 26-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Initial implementation of __cxa_thread_atexit_impl

This is initial implementations; does not yet handle
dlclose - undefined behavior, needs linker support to
handle it right.

Bug: 19800080
Bug: 16696563
Change-Id: I7a3e21ed7f7ec01e62ea1b7cb2ab253590ea0686