Subject: Re: reference to ___tls_get_addr
To: None <tech-toolchain@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-toolchain
Date: 04/25/2007 21:58:44
On Wed, Apr 25, 2007 at 08:40:47PM +0200, Manuel Bouyer wrote:
> On Wed, Apr 25, 2007 at 08:09:35PM +0200, Joerg Sonnenberger wrote:
> > On Wed, Apr 25, 2007 at 07:57:41PM +0200, Manuel Bouyer wrote:
> > > But I suspect this is because there is:
> > > static __thread xc_error last_error = { XC_ERROR_NONE, ""};
> > > static __thread char errbuf[32];
> > > in xc_private.c 
> > > 
> > > is there a way to fix/workaroud this ? This is NetBSD 4.0_BETA2
> > 
> > You can change it to use pthread_getspecific/pthread_setspecific, but
> > that is the only easy way to avoid implementing TLS.
> 
> OK, I think I see how to use it. Does anyone knows the magic to
> call a function at program startup, without calling it from main() ?
> 
> All this is in a library, and I don't want to change each caller to
> do the pthread_key_create() thing ...

Well, it's enough to call it at the first call to the library, if I understood
the man page.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--