[PATCH] libstdc++: Ensure __gthread_self doesn't call undefined weak symbol [PR 95989]

Jonathan Wakely jwakely@redhat.com
Wed Nov 11 19:24:03 GMT 2020


On 11/11/20 19:08 +0100, Jakub Jelinek via Libstdc++ wrote:
>On Wed, Nov 11, 2020 at 05:24:42PM +0000, Jonathan Wakely wrote:
>> --- a/libgcc/gthr-posix.h
>> +++ b/libgcc/gthr-posix.h
>> @@ -684,7 +684,14 @@ __gthread_equal (__gthread_t __t1, __gthread_t __t2)
>>  static inline __gthread_t
>>  __gthread_self (void)
>>  {
>> +#if __GLIBC_PREREQ(2, 27)
>
>What if it is a non-glibc system where __GLIBC_PREREQ macro isn't defined?

Ah yes, I forgot non-glibc systems exist :-)

Thanks, I'll fix it tomorrow, and test on some more targets.

>I think you'd get then
>error: missing binary operator before token "("
>So I think you want
>#if defined __GLIBC__ && defined __GLIBC_PREREQ
>#if __GLIBC_PREREQ(2, 27)
>  return pthread_self ();
>#else
>  return __gthrw_(pthread_self) ();
>#else
>  return __gthrw_(pthread_self) ();
>#endif
>or similar.
>
>	Jakub
>



More information about the Libstdc++ mailing list