__gthread_active_p() in libgcc checks for thread support by looking for
the presence of a symbol from libpthread. With glibc, it looks for
__pthread_key_create. However, it determines that glibc is being used by
checking for a definition of __GLIBC__, which is also defined by uClibc
(in include/features.h), but it does not export __pthread_key_create,
causing the test to always fail. I've fixed this by extending the test
for glibc to check that __UCLIBC__ is not defined, causing the default
pthread_cancel to be tested with uClibc instead.
This affects anything that uses the C++11 thread library together with
the uClibc implementation of libpthread. This caused a large number of
failed tests from the g++, libgomp and libstdc++ testsuites when run on
a MIPS Linux target with uClibc as the C library.
Kwok
2014-10-11 Kwok Cheung Yeung <k...@codesourcery.com>
libgcc/
* gthr-posix.h (GTHR_ACTIVE_PROXY): Check that __UCLIBC__ is
not defined before defining to __gthrw_(__pthread_key_create).
Index: libgcc/gthr-posix.h
===================================================================
--- libgcc/gthr-posix.h (revision 216119)
+++ libgcc/gthr-posix.h (working copy)
@@ -232,7 +232,7 @@
library does not provide pthread_cancel, so we do use pthread_create
there (and interceptor libraries lose). */
-#ifdef __GLIBC__
+#if defined (__GLIBC__) && !defined (__UCLIBC__)
__gthrw2(__gthrw_(__pthread_key_create),
__pthread_key_create,
pthread_key_create)