Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Sep 2011 11:01:30 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        "Thinker K.F. Li" <thinker@codemud.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Thread-local storage issue
Message-ID:  <20110915080130.GL17489@deviant.kiev.zoral.com.ua>
In-Reply-To: <20110915.105047.104045404.thinker@eeebox.branda.to>
References:  <20110915.105047.104045404.thinker@eeebox.branda.to>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Thu, Sep 15, 2011 at 10:50:47AM +0800, Thinker K.F. Li wrote:
> Hi Guys,
> 
> I was in trouble for an issue of TLS implementation of FreeBSD.  It is
> an issue of ld-elf.so actually.  If I have a thread-local variable in
> program, the value of the variable is not consistent after an
> dlopen().  For example,
> 
> __thread int var = 50;
> 
> void modify() {
>      var = 100;
> }
> 
> void show() {
>      printf("%d\n", var);
> }
> 
> int main(int argc, char * const *argv) {
>     dlopen(...);
>     modify();
>     show();
> }
> 
> If it is compiled with -fpic, it would print "50" while "100" is
> expected. (-fpic is required for shared objects)
> 
> I have send-pr a patch as
> 
> 	http://www.freebsd.org/cgi/query-pr.cgi?pr=160721
> 
> I need someone to review it.

I already sent the request to re@ to commit the change.
Thanks for the submission.

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk5xsNoACgkQC3+MBN1Mb4gIXwCgjjkVsLmsEvbZsNikN8eerka/
EToAnixRF91XSkb9K78g0qq/COy3EUKw
=VHws
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110915080130.GL17489>