From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 15 08:01:41 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11006106564A for ; Thu, 15 Sep 2011 08:01:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 67CD38FC0C for ; Thu, 15 Sep 2011 08:01:40 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8F81UTh019735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Sep 2011 11:01:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p8F81UIr012117; Thu, 15 Sep 2011 11:01:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p8F81U2Z012116; Thu, 15 Sep 2011 11:01:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 15 Sep 2011 11:01:30 +0300 From: Kostik Belousov To: "Thinker K.F. Li" Message-ID: <20110915080130.GL17489@deviant.kiev.zoral.com.ua> References: <20110915.105047.104045404.thinker@eeebox.branda.to> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WdUsZMUkvvqwUt1b" Content-Disposition: inline In-Reply-To: <20110915.105047.104045404.thinker@eeebox.branda.to> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: Thread-local storage issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 08:01:41 -0000 --WdUsZMUkvvqwUt1b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 15, 2011 at 10:50:47AM +0800, Thinker K.F. Li wrote: > Hi Guys, >=20 > 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, >=20 > __thread int var =3D 50; >=20 > void modify() { > var =3D 100; > } >=20 > void show() { > printf("%d\n", var); > } >=20 > int main(int argc, char * const *argv) { > dlopen(...); > modify(); > show(); > } >=20 > If it is compiled with -fpic, it would print "50" while "100" is > expected. (-fpic is required for shared objects) >=20 > I have send-pr a patch as >=20 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D160721 >=20 > I need someone to review it. I already sent the request to re@ to commit the change. Thanks for the submission. --WdUsZMUkvvqwUt1b Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5xsNoACgkQC3+MBN1Mb4gIXwCgjjkVsLmsEvbZsNikN8eerka/ EToAnixRF91XSkb9K78g0qq/COy3EUKw =VHws -----END PGP SIGNATURE----- --WdUsZMUkvvqwUt1b--