From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2061 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: TLS (thread-local storage) support Date: Sat, 6 Oct 2012 16:58:05 -0400 Message-ID: <20121006205804.GO254@brightrain.aerifal.cx> References: <20121004211332.GA12874@brightrain.aerifal.cx> <20121005030414.GM254@brightrain.aerifal.cx> <20121005172729.GN254@brightrain.aerifal.cx> <20121006143300.GE24157@port70.net> <20121006203939.GF24157@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1349557608 11975 80.91.229.3 (6 Oct 2012 21:06:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Oct 2012 21:06:48 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2062-gllmg-musl=m.gmane.org@lists.openwall.com Sat Oct 06 23:06:54 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TKbaH-00057Y-L1 for gllmg-musl@plane.gmane.org; Sat, 06 Oct 2012 23:06:53 +0200 Original-Received: (qmail 31839 invoked by uid 550); 6 Oct 2012 21:06:47 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31831 invoked from network); 6 Oct 2012 21:06:47 -0000 Content-Disposition: inline In-Reply-To: <20121006203939.GF24157@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2061 Archived-At: On Sat, Oct 06, 2012 at 10:39:39PM +0200, Szabolcs Nagy wrote: > * Szabolcs Nagy [2012-10-06 16:33:01 +0200]: > > should the attached code work with dlopen > > when compiled as a dso? > > > > (i wanted to check if the alignments are ok after a dlopen, > > but i can see how this usage may not be supported) > > > > it seems it dies here in the ctor > > a more minimal example: > > a.c: > __thread int xx; > int *p; > __attribute__((constructor)) static void init(void) > { > p = &xx; > } > > b.c: > #include > void *h; > int main() > { > h = dlopen("./a.so", RTLD_LAZY); > } > > compiled as > musl-gcc -shared -fPIC -g -o a.so a.c > musl-gcc -g -o b b.c > > ../b segfaults in init at p=&xx Very stupid issue, fixed by commit 92e1cd9b0ba9a8fa86e0346b121e159fb88f99bc: http://git.musl-libc.org/cgit/musl/commit/?id=92e1cd9b0ba9a8fa86e0346b121e159fb88f99bc Rich