This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via 13a6cfff31774dd06b861f1f4a9b0e36fa5ac01d (commit)
from 4d8e5484afb4978f672a8568ddd12e628fb02724 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 13a6cfff31774dd06b861f1f4a9b0e36fa5ac01d
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Mon Oct 12 16:21:54 2015 +0200
fix static binaries linked with pthread and compiled with ssp
Move TLS initialization for static builds up to the calling
function as suggested by Daniel Fahlgren.
Reported-By: Daniel Fahlgren <daniel(a)fahlgren.se>
-----------------------------------------------------------------------
Summary of changes:
libc/misc/internals/__uClibc_main.c | 12 ++++++++++++
libpthread/nptl/init.c | 18 ------------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 1f1e601..632a252 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -32,6 +32,7 @@
#include <pthread-functions.h>
#include <not-cancel.h>
#include <atomic.h>
+#include <tls.h>
#endif
#ifdef __UCLIBC_HAS_THREADS__
#include <pthread.h>
@@ -132,6 +133,10 @@ extern void __pthread_initialize_minimal(void);
#endif
#endif
+#ifndef SHARED
+extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
+#endif
+
/* If __UCLIBC_FORMAT_SHARED_FLAT__, all array initialisation and finalisation
* is handled by the routines passed to __uClibc_main(). */
#if defined (__UCLIBC_CTOR_DTOR__) && !defined (__UCLIBC_FORMAT_SHARED_FLAT__)
@@ -243,6 +248,13 @@ void __uClibc_init(void)
__pagesize = PAGE_SIZE;
#ifdef __UCLIBC_HAS_THREADS__
+
+#if defined (__UCLIBC_HAS_THREADS_NATIVE__) && !defined (SHARED)
+ /* Unlike in the dynamically linked case the dynamic linker has not
+ taken care of initializing the TLS data structures. */
+ __libc_setup_tls (TLS_TCB_SIZE, TLS_TCB_ALIGN);
+#endif
+
/* Before we start initializing uClibc we have to call
* __pthread_initialize_minimal so we can use pthread_locks
* whenever they are needed.
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index a9706d1..bcd49ed 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -60,15 +60,9 @@ int __have_futex_clock_realtime;
/* Version of the library, used in libthread_db to detect mismatches. */
static const char nptl_version[] __attribute_used__ = VERSION;
-
-#ifndef SHARED
-extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
-#endif
-
#ifdef SHARED
static void nptl_freeres (void);
-
static const struct pthread_functions pthread_functions =
{
.ptr_pthread_attr_destroy = __pthread_attr_destroy,
@@ -265,18 +259,6 @@ __pthread_initialize_minimal_internal (void)
return;
initialized = 1;
-#ifndef SHARED
- /* Unlike in the dynamically linked case the dynamic linker has not
- taken care of initializing the TLS data structures. */
- __libc_setup_tls (TLS_TCB_SIZE, TLS_TCB_ALIGN);
-
- /* We must prevent gcc from being clever and move any of the
- following code ahead of the __libc_setup_tls call. This function
- will initialize the thread register which is subsequently
- used. */
- __asm__ __volatile__ ("");
-#endif
-
/* Minimal initialization of the thread descriptor. */
struct pthread *pd = THREAD_SELF;
INTERNAL_SYSCALL_DECL (err);
hooks/post-receive
--
uClibc-ng - small C library for embedded systems