I have a piece of C/C++ code that uses __thread keyword for thread local storage but having trouble getting it compiled on 64-bit Solaris Sparc with g++ (version 4.0.2), while it compiles and runs OK on linux with g++34 compiler. Here is an example of source code:
__thread int count = 0;
Compiler info from 'g++ -dumpversion' command returns '4.0.2' and 'g++ -dumpmachine' shows 'sparc-sun-solaris2.8'. 'uname -a' displays 'SunOS devsol1 5.9 Generic_118558-26 sun4u sparc SUNW,UltraAX-i2'.
The error message while running make with g++ is: "error: thread-local storage not supported for this target", and compiler option I am using is
-m64 -g -fexceptions -fPIC -I../fincad -I/usr/java_1.6.0_12/include -I/usr/java_1.6.0_12/include/solaris -I/opt/csw/gcc4/lib/sparcv9 -I/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.2/sparcv9 -I. -I/usr/include -I/usr/include/iso -I/usr/local/include
Any help is very much appreciated as I have being struggling on this over the weekend and am facing a deadline.
Thanks, Charles