about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-18 19:08:21 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-02-18 19:08:21 +0530
commitba384f6ed9275f3966505f2375b56d169e3dc588 (patch)
treed832a5a24bab934c946089b8d2a9a16f1766470d /include
parentffaa74cf68a370e232279a9a9b0a02ade287cc99 (diff)
downloadglibc-ba384f6ed9275f3966505f2375b56d169e3dc588.tar.gz
glibc-ba384f6ed9275f3966505f2375b56d169e3dc588.tar.xz
glibc-ba384f6ed9275f3966505f2375b56d169e3dc588.zip
C++11 thread_local destructors support
This feature is specifically for the C++ compiler to offload calling
thread_local object destructors on thread program exit, to glibc.
This is to overcome the possible complication of destructors of
thread_local objects getting called after the DSO in which they're
defined is unloaded by the dynamic linker.  The DSO is marked as
'unloadable' if it has a constructed thread_local object and marked as
'unloadable' again when all the constructed thread_local objects
defined in it are destroyed.
Diffstat (limited to 'include')
-rw-r--r--include/link.h3
-rw-r--r--include/stdlib.h5
2 files changed, 8 insertions, 0 deletions
diff --git a/include/link.h b/include/link.h
index 230e95d6c8..7dc3cd1e32 100644
--- a/include/link.h
+++ b/include/link.h
@@ -302,6 +302,9 @@ struct link_map
     /* Index of the module in the dtv array.  */
     size_t l_tls_modid;
 
+    /* Number of thread_local objects constructed by this DSO.  */
+    size_t l_tls_dtor_count;
+
     /* Information used to change permission after the relocations are
        done.  */
     ElfW(Addr) l_relro_addr;
diff --git a/include/stdlib.h b/include/stdlib.h
index 2e536641b9..db1812d85a 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -100,6 +100,11 @@ extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
 extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d)
      attribute_hidden;
 
+extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
+				     void *d);
+extern void __call_tls_dtors (void);
+libc_hidden_proto (__call_tls_dtors);
+
 extern void __cxa_finalize (void *d);
 
 extern int __posix_memalign (void **memptr, size_t alignment, size_t size);