aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-06-04 21:35:57 (GMT)
committerRyan Prichard <rprichard@google.com>2018-06-06 04:10:07 (GMT)
commit89b2029895df0a3f3587eeba0a519091c3f7a1b5 (patch)
tree2206d3174a4c79cf148fab6c8916cc9e3c62e084
parent81788f3d99d2c5952fa9a6d673e8d6a53b76d511 (diff)
downloadtoolchain_gcc-89b2029895df0a3f3587eeba0a519091c3f7a1b5.zip
toolchain_gcc-89b2029895df0a3f3587eeba0a519091c3f7a1b5.tar.gz
toolchain_gcc-89b2029895df0a3f3587eeba0a519091c3f7a1b5.tar.bz2
Add __emutls_unregister_key function
Replace the existing __attribute__((destructor)) function, unregister_emutls_key, with a function that something else must call explicitly. We don't want the pthread key deleted at program exit, because it's unnecessary and because it may delete the key before other tls-using cleanup code runs. Exposing __emutls_unregister_key allows limiting the cleanup to dlclose (e.g. by calling it only from crtbegin_so.c). Reset emutls_key_created so multiple calls to __emutls_unregister_key are safe. Bug: b/80453944 Test: manual Change-Id: I82d13614ae8042d0501fd2ca64f0ef6189669905
-rw-r--r--gcc-4.9/libgcc/emutls.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc-4.9/libgcc/emutls.c b/gcc-4.9/libgcc/emutls.c
index 525db28..93c3c07 100644
--- a/gcc-4.9/libgcc/emutls.c
+++ b/gcc-4.9/libgcc/emutls.c
@@ -121,12 +121,15 @@ emutls_init (void)
emutls_key_created = 1;
}
-__attribute__((destructor))
-static void
-unregister_emutls_key (void)
+__attribute__((visibility("hidden")))
+void
+__emutls_unregister_key (void)
{
if (emutls_key_created)
- __gthread_key_delete (emutls_key);
+ {
+ emutls_key_created = 0;
+ __gthread_key_delete (emutls_key);
+ }
}
#endif