[uclibc-ng-devel] pthread_mutex_*() functions, dynamic vs. static linking

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Aug 18 22:39:34 CEST 2016


Hello,

On Thu, 18 Aug 2016 22:33:35 +0200, Waldemar Brodkorb wrote:

> What about following patch, which creates dummies for
> pthread_mutex_* functions in the !SHARED case:
> 
> From 8d11aa1b9a983e0422dffa84eb1a7b71c616a096 Mon Sep 17 00:00:00 2001
> From: Waldemar Brodkorb <wbx at uclibc-ng.org>
> Date: Thu, 18 Aug 2016 08:17:36 +0200
> Subject: [PATCH] add dummies
> 
> 
> Signed-off-by: Waldemar Brodkorb <wbx at uclibc-ng.org>
> ---
>  libc/misc/internals/__uClibc_main.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
> index 9bb81fc..9320039 100644
> --- a/libc/misc/internals/__uClibc_main.c
> +++ b/libc/misc/internals/__uClibc_main.c
> @@ -81,6 +81,9 @@ static int __pthread_return_0 (pthread_mutex_t *unused) { return 0; }
>  weak_alias (__pthread_return_0, __pthread_mutex_lock)
>  weak_alias (__pthread_return_0, __pthread_mutex_trylock)
>  weak_alias (__pthread_return_0, __pthread_mutex_unlock)
> +weak_alias (__pthread_return_0, pthread_mutex_lock)
> +weak_alias (__pthread_return_0, pthread_mutex_trylock)
> +weak_alias (__pthread_return_0, pthread_mutex_unlock)

Hum, why not, but this raises a few questions:

 - Why does it work in the shared case and not in the static case?

 - What are those __pthread_mutex_* variants?

Do we have a list of the pthread functions that libc.so/libc.a is
supposed to provide? See the mail I just send about the axel/libintl
issue where libintl also uses pthread_rwlock_*() without being linked
with libpthread.so.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


More information about the devel mailing list