6 Replies Latest reply on Jul 22, 2008 5:50 PM by 807575

    "error: thread-local storage not supported for this target"

    807575
      I have a program that uses the __thread specifier, to be run on a Solaris 9/UltraSprac.
      I am not able to compile it using gcc 3.4.4 or 4.0.4, it emits the msg "error: thread-local storage not supported for this target".
      xz@gamera% gcc -v -Wall -D_REENTRANT -c -o func_stack.o func_stack.c
      Reading specs from /opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/specs
      Configured with: ../srcdir/configure --prefix=/opt/gcc/3.4.4 --disable-nls
      Thread model: posix
      gcc version 3.4.4
       /opt/gcc/3.4.4/libexec/gcc/sparc-sun-solaris2.8/3.4.4/cc1 -quiet -v -D_REENTRANT -DMESS func_stack.c -quiet -dumpbase func_stack.c -mcpu=v7 -auxbase-strip func_stack.o -Wall -version -o /var/tmp//cc0poHSN.s
      ignoring nonexistent directory "/usr/local/include"
      ignoring nonexistent directory "/opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/../../../../sparc-sun-solaris2.8/include"
      #include "..." search starts here:
      #include <...> search starts here:
       /opt/gcc/3.4.4/include
       /opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/include
       /usr/include
      End of search list.
      GNU C version 3.4.4 (sparc-sun-solaris2.8)
              compiled by GNU C version 3.4.4.
      GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
      func_stack.c:16: error: thread-local storage not supported for this target
      func_stack.c:17: error: thread-local storage not supported for this target
      func_stack.c:19: error: thread-local storage not supported for this target
      xs@gamera% gcc -v -D_REENTRANT  -c -o func_stack.o func_stack.c
      Using built-in specs.
      Target: sparc-sun-solaris2.9
      Configured with: /net/clpt-v490-0/export/data/bldmstr/20070711_mars_gcc/src/configure --prefix=/usr/sfw --enable-shared --with-system-zlib --enable-checking=release --disable-libmudflap --enable-languages=c,c++ --enable-version-specific-runtime-libs --with-cpu=v9 --with-ld=/usr/ccs/bin/ld --without-gnu-ld
      Thread model: posix
      gcc version 4.0.4 (gccfss)
       /pkg/gcc/4.0.4/bin/../libexec/gcc/sparc-sun-solaris2.9/4.0.4/cc1 -quiet -v -I. -iprefix /pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/ -D__sparcv8 -D_REENTRANT -DMESS func_stack.c -quiet -dumpbase func_stack.c -mcpu=v9 -auxbase-strip func_stack.o -version -m32 -o /tmp/ccjsdswh.s -r /tmp/cc2w4ZRo.ir
      ignoring nonexistent directory "/pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/../../../../sparc-sun-solaris2.9/include"
      ignoring nonexistent directory "/usr/local/include"
      ignoring nonexistent directory "/usr/sfw/lib/gcc/sparc-sun-solaris2.9/4.0.4/include"
      ignoring nonexistent directory "/usr/sfw/lib/../sparc-sun-solaris2.9/include"
      #include "..." search starts here:
      #include <...> search starts here:
       .
       /pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/include
       /usr/sfw/include
       /usr/include
      End of search list.
      GNU C version 4.0.4 (gccfss) (sparc-sun-solaris2.9)
              compiled by GNU C version 4.0.4 (gccfss).
      GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
      func_stack.c:16: error: thread-local storage not supported for this target
      func_stack.c:17: error: thread-local storage not supported for this target
      func_stack.c:19: error: thread-local storage not supported for this target
      Just as comparison, the corresponding output of compiling another file which does not have __thread declaration is as follows:
      xz@gamera% gcc -v -Wall -D_REENTRANT -c -o common.o common.c
      Reading specs from /opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/specs
      Configured with: ../srcdir/configure --prefix=/opt/gcc/3.4.4 --disable-nls
      Thread model: posix
      gcc version 3.4.4
       /opt/gcc/3.4.4/libexec/gcc/sparc-sun-solaris2.8/3.4.4/cc1 -quiet -v -D_REENTRANT -DMESS common.c -quiet -dumpbase common.c -mcpu=v7 -auxbase-strip common.o -Wall -version -o /var/tmp//cc4VxrLz.s
      ignoring nonexistent directory "/usr/local/include"
      ignoring nonexistent directory "/opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/../../../../sparc-sun-solaris2.8/include"
      #include "..." search starts here:
      #include <...> search starts here:
       /opt/gcc/3.4.4/include
       /opt/gcc/3.4.4/lib/gcc/sparc-sun-solaris2.8/3.4.4/include
       /usr/include
      End of search list.
      GNU C version 3.4.4 (sparc-sun-solaris2.8)
              compiled by GNU C version 3.4.4.
      GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
       /usr/ccs/bin/as -V -Qy -s -xarch=v8 -o common.o /var/tmp//cc4VxrLz.s
      /usr/ccs/bin/as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02
      Note that the last 2 lines seem to suggest that a Sun assembler is used as the back-end of gcc. I am not sure whether the failure to compile the first file (with __thread) was due to the incompatibility of this Sun assembler. In the first case, the error msg was emitted before these 2 lines are printed.
      I further read a post about gcc 3.3.3's inability to compile code that has __thread in it, on a HP-UX 11.11: http://forums12.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1216595175060+28353475&threadId=1148976 The conclusion seems to suggest that "the 2.17 GNU assembler did not support thread local storage" and gcc sees that and thus disallows TLS.
      If the assembler is the culprit, then does anyone know whether this "Sun WorkShop 6 update 2" assembler in my installation can work with TLS? And how come a Sun assembler becomes the back-end of gcc? I read that gas (the GNU assembler) is the default backend of gcc. (How) can one specify the assembler to be used for gcc?

      As an aside, I am able to compile my file on this same Solaris 9/UltraSparc platform using the Sun Studio 12 C Compiler:
      xz@gamera% cc -V -# -D_REENTRANT  -c -o func_stack.o func_stack.c
      cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
      ### Note: NLSPATH = /pkg/SUNWspro/12/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/pkg/SUNWspro/12/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
      ###     command line files and options (expanded):
      ### -c -D_REENTRANT  -V func_stack.c -o func_stack.o
      /pkg/SUNWspro/12/prod/bin/acomp -xldscope=global -i func_stack.c -y-fbe -y/pkg/SUNWspro/12/prod/bin/fbe -y-xarch=generic -y-xmemalign=8i -y-o -yfunc_stack.o -y-verbose -y-xthreadvar=no%dynamic -y-comdat -xdbggen=no%stabs+dwarf2+usedonly -V -D_REENTRANT  -m32 -fparam_ir -Qy -D__SunOS_5_9 -D__SUNPRO_C=0x590 -D__SVR4 -D__sun -D__SunOS -D__unix -D__sparc -D__BUILTIN_VA_ARG_INCR -D__C99FEATURES__ -Xa -D__PRAGMA_REDEFINE_EXTNAME -Dunix -Dsun -Dsparc -D__RESTRICT -xc99=%all,no%lib -D__FLT_EVAL_METHOD__=0 -I/pkg/SUNWspro/12/prod/include/cc "-g/pkg/SUNWspro/12/prod/bin/cc -V -D_REENTRANT  -c -o func_stack.o " -fsimple=0 -D__SUN_PREFETCH -destination_ir=yabe
      acomp: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
      Interestingly, the output no longer mentions the "/usr/ccs/bin/as: Sun WorkShop 6 update 2" assembler.
        • 1. Re: "error: thread-local storage not supported for this target"
          807575
          I compiled the same file (with a __thread declaration) using gcc 4.0.4 on a Soalris 10/x86 platform and it compiled, apparently using the 2.15 GNU assembler.
          xz@marge% gcc -v -Wall -D_REENTRANT -c -o func_stack.o func_stack.c
          Using built-in specs.
          Target: i386-pc-solaris2.10
          Configured with: ../src/configure --prefix=/opt/gcc/4.0.4 --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-languages=c,c++
          Thread model: posix
          gcc version 4.0.4
           /opt/gcc/4.0.4/libexec/gcc/i386-pc-solaris2.10/4.0.4/cc1 -quiet -v -D_REENTRANT  func_stack.c -quiet -dumpbase func_stack.c -auxbase-strip func_stack.o -Wall -version -o /var/tmp//cc4AiygC.s
          ignoring nonexistent directory "/usr/local/include"
          ignoring nonexistent directory "/opt/gcc/4.0.4/lib/gcc/i386-pc-solaris2.10/4.0.4/../../../../i386-pc-solaris2.10/include"
          #include "..." search starts here:
          #include <...> search starts here:
           /opt/gcc/4.0.4/include
           /opt/gcc/4.0.4/lib/gcc/i386-pc-solaris2.10/4.0.4/include
           /usr/include
          End of search list.
          GNU C version 4.0.4 (i386-pc-solaris2.10)
                  compiled by GNU C version 4.0.4.
          GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
           /usr/sfw/bin/gas --traditional-format -V -Qy -s -o func_stack.o /var/tmp//cc4AiygC.s
          GNU assembler version 2.15 (i386-pc-solaris2.10) using BFD version 2.15
          So I do not know whether the claim that GNU assembler 2.17 was responsible is valid or not.
          • 2. Re: "error: thread-local storage not supported for this target"
            807575
            Just as another comparison, I compiled a file without __thread on the Solaris 9/UltraSparc platform using gcc 4.0.4. Not surprisingly it worked. But I no longer see the mention of the Sun assembler as in the case of gcc 3.4.4. Nor did I see the mention of "GNU assembler" as in the case of gcc 4.0.4/Solaris 10/x86. Instead, I saw something called "iropt" and "cg". Does anyone know what they are?
            xz@gamera% gcc -v -Wall -D_REENTRANT -c -o common.o common.c
            Using built-in specs.
            Target: sparc-sun-solaris2.9
            Configured with: /net/clpt-v490-0/export/data/bldmstr/20070711_mars_gcc/src/configure --prefix=/usr/sfw --enable-shared --with-system-zlib --enable-checking=release --disable-libmudflap --enable-languages=c,c++ --enable-version-specific-runtime-libs --with-cpu=v9 --with-ld=/usr/ccs/bin/ld --without-gnu-ld
            Thread model: posix
            gcc version 4.0.4 (gccfss)
             /pkg/gcc/4.0.4/bin/../libexec/gcc/sparc-sun-solaris2.9/4.0.4/cc1 -quiet -v -iprefix /pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/ -D__sparcv8 -D_REENTRANT -DMESS common.c -quiet -dumpbase common.c -mcpu=v9 -auxbase-strip common.o -Wall -version -m32 -o /tmp/ccSGJIDD.s -r /tmp/ccKuJz76.ir
            ignoring nonexistent directory "/pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/../../../../sparc-sun-solaris2.9/include"
            ignoring nonexistent directory "/usr/local/include"
            ignoring nonexistent directory "/usr/sfw/lib/gcc/sparc-sun-solaris2.9/4.0.4/include"
            ignoring nonexistent directory "/usr/sfw/lib/../sparc-sun-solaris2.9/include"
            #include "..." search starts here:
            #include <...> search starts here:
             /pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4/include
             /usr/sfw/include
             /usr/include
            End of search list.
            GNU C version 4.0.4 (gccfss) (sparc-sun-solaris2.9)
                    compiled by GNU C version 4.0.4 (gccfss).
            GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
             /pkg/gcc/4.0.4/SUNW0scgfss/4.0.4/prod/bin/iropt -F -xarch=v8plus -xchip=generic -O1 -xvector=no -xbuiltin=%none -xcache=generic -Qy -h_gcc -o /tmp/ccUl4mVM.ircg /tmp/ccKuJz76.ir -N/dev/null -is /tmp/ccSGJIDD.s
             /pkg/gcc/4.0.4/SUNW0scgfss/4.0.4/prod/bin/cg -Qy -xarch=v8plus -xchip=generic -OO0 -T3 -Qiselect-C0 -Qrm:newregman:coalescing=0 -xcode=abs32 -xcache=generic -xmemalign=8i -il /pkg/gcc/4.0.4/bin/../lib/gcc/sparc-sun-solaris2.9/4.0.4//gccbuiltins.il -xvector=no -xthreadvar=no%dynamic -xbuiltin=%none -Qassembler-ounrefsym=0 -Qiselect-T0 -Qassembler-I -Qassembler-U -comdat -h_gcc -is /tmp/ccSGJIDD.s -ir /tmp/ccUl4mVM.ircg -oo common.o
            • 3. Re: "error: thread-local storage not supported for this target"
              807575
              What you are using is GCC for SPARC systems, which is using the SunStudio optimizer and code generator.
              These are the iropt/cg you see on the command line. The assembler will be invoked only when generating object files
              from *.s files.
              • 4. Re: "error: thread-local storage not supported for this target"
                807575
                Are you saying
                1. the error occurs before the assembler is invoked, or
                2. the assembler is never supposed to be invoked if I compile using the -c flag? - but then how do you explain the third code segment whether apparently the assembler (/usr/ccs/bin/as) is invoked and fifth code segment where the GNU assembler is apparently invoked?

                Is "GNU C version 3.4.4 (sparc-sun-solaris2.8)" also GCC for SPARC Systems though it does not explicitly say so? So, "GCC for SPARC Systems" is different from GCC in the sense that __thread is supported by GCC but not by GCCFSS?
                • 5. Re: "error: thread-local storage not supported for this target"
                  807575
                  Wikipedia page for Sun Studio (http://en.wikipedia.org/wiki/Sun_Studio_Compiler_Suite) says "The gccfss (GCC for SPARC Systems) compiler uses gcc's front end and Sun Studio's back end."
                  Apparently the gcc 4.0.4 front-end (in combination with GNU assembler) can compile a program with __thread, and the Sun back-end (as - assembler) can work with Sun cc to compile the same program, I suppose there must be something wrong when the developers combine gcc 4.0.4 front-end with the Sun back-end. Since this forum is used to report GCCFSS problems, I am now officially report this as a problem.
                  • 6. Re: "error: thread-local storage not supported for this target"
                    807575
                    Thank you. The feature is working on S10, looks like a configuration issue on the S9 machine we build it on. We are looking into it.

                    Prashanth