diff options
author | Ryan Prichard <rprichard@google.com> | 2018-06-01 13:07:03 -0700 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2018-06-19 13:22:36 -0700 |
commit | bcea0e2afd21ab72bcd7fef27af08dfe9bdcab29 (patch) | |
tree | 7d5e7180e8cac316056e821ab9aa62a8d16ba02a /libc/malloc_debug/malloc_debug.cpp | |
parent | 520ad0cae8f68166ca323c07ab704e5fbdc4f655 (diff) |
Call __emutls_unregister_key on dlclose
We want to delay the emutls pthread key deletion to keep
__thread/thread_local variables working as long as possible.
Currently, emutls has its own __attribute__((destructor)) function that
deletes its pthread key. That function runs even on process exit, and it
can run before other destructor functions and before C++ static object
destructors.
Move the destructor function to crtbegin_so.c, where an
__attribute__((destructor)) function is only called on dlclose. Use a
priority 0 destructor, which runs after every destructor with a default or
greater priority value.
__emutls_unregister_key will still run before destructor functions of
DT_NEEDED solibs. It also still leaks memory (both the emutls arrays and
each emutls object).
Bug: b/80453944
Test: manual
Change-Id: I6789bcf168415ab8badf2f64687c6a0136c5c917
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
0 files changed, 0 insertions, 0 deletions