[PATCH] D52251: [builtins] Add __emutls_unregister_key function
Yi Kong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 19 18:05:53 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342608: [builtins] Add __emutls_unregister_key function (authored by kongyi, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D52251?vs=166195&id=166209#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52251
Files:
compiler-rt/trunk/lib/builtins/emutls.c
Index: compiler-rt/trunk/lib/builtins/emutls.c
===================================================================
--- compiler-rt/trunk/lib/builtins/emutls.c
+++ compiler-rt/trunk/lib/builtins/emutls.c
@@ -42,6 +42,7 @@
static pthread_mutex_t emutls_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t emutls_pthread_key;
+static bool emutls_key_created = false;
typedef unsigned int gcc_word __attribute__((mode(word)));
typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
@@ -109,6 +110,7 @@
static __inline void emutls_init(void) {
if (pthread_key_create(&emutls_pthread_key, emutls_key_destructor) != 0)
abort();
+ emutls_key_created = true;
}
static __inline void emutls_init_once(void) {
@@ -390,3 +392,14 @@
array->data[index] = emutls_allocate_object(control);
return array->data[index];
}
+
+#ifdef __BIONIC__
+/* Called by Bionic on dlclose to delete the emutls pthread key. */
+__attribute__((visibility("hidden")))
+void __emutls_unregister_key(void) {
+ if (emutls_key_created) {
+ pthread_key_delete(emutls_pthread_key);
+ emutls_key_created = false;
+ }
+}
+#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52251.166209.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180920/3def51b2/attachment.bin>
More information about the llvm-commits
mailing list