summaryrefslogtreecommitdiffstats
path: root/src/usr/module_init.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/module_init.C')
-rw-r--r--src/usr/module_init.C15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/usr/module_init.C b/src/usr/module_init.C
index b07ace0c2..3e9a25e58 100644
--- a/src/usr/module_init.C
+++ b/src/usr/module_init.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -21,6 +23,8 @@
/* */
/* IBM_PROLOG_END_TAG */
void call_dtors(void * i_dso_handle);
+void __tls_register(void * tls_start, void * tls_end);
+void __tls_unregister(void * tls_start, void * tls_end);
// This identifies the module
void* __dso_handle = (void*) &__dso_handle;
@@ -28,6 +32,11 @@ void* __dso_handle = (void*) &__dso_handle;
extern "C"
void _init(void*)
{
+ // Register thread-local storage.
+ extern void* tls_start_address;
+ extern void* tls_end_address;
+ __tls_register(&tls_start_address, &tls_end_address);
+
// Call default constructors for any static objects.
extern void (*ctor_start_address)();
extern void (*ctor_end_address)();
@@ -43,6 +52,10 @@ extern "C"
void _fini(void)
{
call_dtors(__dso_handle);
+
+ extern void* tls_start_address;
+ extern void* tls_end_address;
+ __tls_unregister(&tls_start_address, &tls_end_address);
}
OpenPOWER on IntegriCloud