[PATCH] libdl: rudimentary locking for dlopen/dlsym/dlclose

Timo Teras timo.teras at iki.fi
Sat May 5 09:02:04 UTC 2012


On Fri, 4 May 2012 12:52:12 -0400 Mike Frysinger <vapier at gentoo.org>
wrote:

> On Friday 04 May 2012 06:10:02 HeinBali wrote:
> > > This implements big-dlfcn lock to allow multithreaded usage of
> > > dlopen/dlsym/dlclose. We should really clean up the dl code so
> > > we can use more fine grained locking or even RCU where
> > > appropriate.
> > 
> > Maybe it would be a good idea to check within libdl.c :
> > 
> > #ifndef PTHREADS_NATIVE
> > #error ...
> > #endif
> > 
> > I just spent a long time wondering why all of the ALSA utilities
> > crashed right after start-up: Buildroot had selected the standard
> > Linux thread type (PTHREADS_OLD)
> 
> the locking code is pthread-implementation independent.  there's no
> reason i can see that this would require NPTL.
> -mike

Sounds like linking order issue, or the fact that the dlopen() loads a
library requring libpthreads (but the main binary does not). Try
linking explicitly the main app against libpthreads. This is still an
issue with PTHREADS_OLD, but I fixed it earlier for NPTL.

-Timo


More information about the uClibc mailing list