problem when pthread_* functions are invoked from dynamic library

Mike Frysinger vapier at gentoo.org
Sat Dec 3 03:20:44 UTC 2005


On Fri, Dec 02, 2005 at 05:46:07PM +0530, Kishore K wrote:
> I am facing some problems if pthread_self() and some other pthread_*
> functions are invoked from a dynamic library.

ok, we chatted on irc and some others (mjn3/andersee) have been
reporting similar behavior ... however, everyone has been using mips,
so there was some suspicion that it's a mips-specific bug in ldso
(which wouldnt be the first time this happened ...)

with that in mind, i just gave your code a spin on an armeb /
uclibc-0.9.28 host and got the same results ... linking test against
-lpthread would fix the output

btw, this command:
> $mips-linux-gcc -shared -o libthreadTest.so threadTest.c -lpthread
should contain -fPIC, but that's unrelated to the issue at hand :)

> Again, if the following line is commented out
>         weak_alias (__pthread_return_0, pthread_self)
> from libc/misc/weaks.c in uClibc source code

i just cleaned up weaks.c and removed all the weaks that libc.so itself
does not require (which includes pthread_self) ... but, that doesnt
change the fact that the mechanism in ldso to handle weaks appears to
be broken ...
-mike



More information about the uClibc mailing list