[PATCH 01/18] nptl: Move pthread_mutex_consistent into libc

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Mar 16 14:07:27 GMT 2021



On 16/03/2021 10:53, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> On 16/03/2021 02:42, Florian Weimer wrote:
>>> * Adhemerval Zanella:
>>>
>>>>> index 937c7c4640..0a84063a2b 100644
>>>>> --- a/nptl/pthread_mutex_consistent.c
>>>>> +++ b/nptl/pthread_mutex_consistent.c
>>>>> @@ -18,10 +18,10 @@
>>>>>  
>>>>>  #include <errno.h>
>>>>>  #include <pthreadP.h>
>>>>> -
>>>>> +#include <shlib-compat.h>
>>>>>  
>>>>>  int
>>>>> -pthread_mutex_consistent (pthread_mutex_t *mutex)
>>>>> +__pthread_mutex_consistent (pthread_mutex_t *mutex)
>>>>>  {
>>>>>    /* Test whether this is a robust mutex with a dead owner.
>>>>>       See concurrency notes regarding __kind in struct __pthread_mutex_s
>>>>> @@ -35,4 +35,20 @@ pthread_mutex_consistent (pthread_mutex_t *mutex)
>>>>>  
>>>>>    return 0;
>>>>>  }
>>>>> -weak_alias (pthread_mutex_consistent, pthread_mutex_consistent_np)
>>>>> +versioned_symbol (libc, __pthread_mutex_consistent, pthread_mutex_consistent,
>>>>> +                  GLIBC_2_34);
>>>>> +
>>>>> +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_34)
>>>>
>>>> Shouldn't be GLIBC_2_12 here?
>>>
>>> Where exactly?  There are so many symbol versions.  The _np variant was
>>> introduced in GLIBC_2.4, so GLIBC_2_4 is correct here.  It ran parallel
>>> with the non-_np variant until GLIBC_2.34, so that's the end range.
>>
>> I meant 'SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12)'
> 
> This would be wrong because until glibc 2.33, both symbols existed in
> parallel AFAICS.
> 

Yeah, you are right.

>>>> I think we have compat_symbol_unique exactly for that.
>>>
>>> It doesn't apply here because the symbol names are different
>>> (__pthread_mutex_consistent vs pthread_mutex_consistent):
>>>
>>> # define compat_symbol_unique(lib, name, version) \
>>>
>>> The macro has just one name argument.
>>
>> Indeed, I will add a macro similar to compat_symbol_unique, but
>> that redirects to a an alias instead.
> 
> We could teach compat_symbol to always create an alias first.
> 
>> Ah right, I didn't noticed the last 'pthread_mutex_consistent'.  
>>
>> Patch look ok then, I think if you could remove the extra 
>> pthread_mutex_consistent define on the installed header would be better
>> but it not a blocker.
> 
> I'm going to repost it as part of the ongoing series.  I could get
> __REDIRECT to work.
> 
> Thanks,
> Florian
> 

Ok.


More information about the Libc-alpha mailing list