problem when pthread_* functions are invoked from dynamiclibrary

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Dec 5 13:39:48 UTC 2005


> 
> On Mon, 5 Dec 2005, Joakim Tjernlund wrote:
> 
> > > 
> > > On Sat, Dec 03, 2005 at 09:01:40PM +0100, Joakim Tjernlund wrote:
> > > > > 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.
> > > > > 
> > > > > 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 ...
> > > > 
> > > > I don't think weak handling is broken. Some time ago glibc 
> > > changed is weak
> > > > handling and I did the same to uClibc. I don't know why 
> > > this change was done.
> > > > In glibc you can set LD_DYNAMIC_WEAK=1 to use the old method.
> > > 
> > > ok, we chatted some more, and it turns out that glibc also updated
> > > their libpthread forward.c file to accommodate the new 
> weak behavior
> > > 
> > > find attached an untested patch against current svn which 
> updates our
> > > weaks.c in the same manner ... the good news is that this 
> should fix
> > > the bugs people are seeing, the bad news is that it makes 
> the weaks
> > > file a bit bigger :( ... although, if i declare the extern 
> > > weak pthread
> > > function as attribute_hidden, it shrinks it considerably, 
> i'm just not
> > > sure if this is correct
> > 
> > Don't think thats correct. What does readelf -a say about the hidden
> > weak functions?
> 
> I am interested if all __libc_X in libc.so could be made 
> hidden weak, so 
> what should readelf -a reveal about them to allow pthread to 
> overwrite 
> them?
> 
> Thanks, Peter

Not sure, but it has to be exported. I am not sure what hidden does to
declarations at all.
For now I am just curious what the difference in readelf -a is, with and
without hidden
for the weak pthread symbols.

 Jocke



More information about the uClibc mailing list