This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix detection of thread support with uClibc in libgcc

On Sat, Oct 11, 2014 at 9:42 AM, Kwok Cheung Yeung <> wrote:
> __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.

Why is __GLIBC__ being defined for uclibc?  That seems broken.  We
complain about __GNUC__ defined for other compilers besides GCC; we
should do the same for defining __GLIBC__ also.


> 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  <>
>     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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]