On Aug 1 13:41, Larry Hall (Cygwin) wrote: > On 08/01/2014 01:32 PM, Ryan Johnson wrote: > >Hi all, > > > >(Please CC me in replies, I'm not subscribed to the list) > > > >Question: is this a Cygwin bug, gcc bug, or somebody else's bug entirely? > > > >The following STC shows the problem: > > > >$ cat bug.cpp > >#include <cstdio> > >static thread_local struct X { > > int x; > > X() { puts("hi"); } > > ~X() { puts("bye!"); } > >} x; > >int main() { x.x = 0; } > > > >$ g++ -std=gnu++11 -Wall -g bug.cpp && ./a > >hi > > > >A quick inspection of the assembly code shows no call to __cxa_thread_atexit > >in __tls_init, where the same code compiled on linux, with the same version > >of gcc, has it right. This is odd, because the function does seem to be > >available in cygwin's libstdc++: > > > >$ nm /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/libstdc++.a | grep thread_atexit > >0000000000000000 d .data$_ZZ19__cxa_thread_atexitE4once > >0000000000000000 p .pdata$__cxa_thread_atexit > >0000000000000000 t .text$__cxa_thread_atexit > >0000000000000000 r .xdata$__cxa_thread_atexit > >0000000000000000 T __cxa_thread_atexit > >0000000000000000 d _ZZ19__cxa_thread_atexitE4once > >[...] > > Well it's not a general gcc problem because the same code on Linux with > version 4.8.3 works for me.
It seems thread_local storage needs to be implemented in GCC for the target, and it isn't. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpaYoy0QSBVV.pgp
Description: PGP signature