public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/38118]  New: gcc emits non-TLS data as TLS on Solaris 11/SPARC
@ 2008-11-14 15:54 ro at gcc dot gnu dot org
  2008-11-14 19:10 ` [Bug target/38118] " ebotcazou at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: ro at gcc dot gnu dot org @ 2008-11-14 15:54 UTC (permalink / raw)
  To: gcc-bugs

While trying to build current mainline with Sun as and GNU ld 2.19 on
sparc-sun-solaris2.11, libgomp failed to link with the following error:

/vol/gcc/lib/gld-2.19: gomp_thread_attr: TLS reference in .libs/team.o
mismatches non-TLS reference in .libs/env.o
.libs/team.o: could not read symbols: Bad value

Further investigation revealed that this is due to a gcc bug: consider the
following testcase:

__thread int tsd;
int non_tsd;

ro@galeras 1510 > ./xgcc -B./ -c ~/tls.c 
ro@galeras 1511 > readelf -s tls.o|grep tsd
     3: 00000004     4 TLS     GLOBAL DEFAULT  COM non_tsd
     4: 00000000     4 TLS     GLOBAL DEFAULT    2 tsd
ro@galeras 1512 > /opt/onstudio12/SUNWspro/bin/cc -c ~/tls.c 
ro@galeras 1513 > readelf -s tls.o|grep tsd
     9: 00000004     4 TLS     GLOBAL DEFAULT  COM tsd
    10: 00000004     4 OBJECT  GLOBAL DEFAULT  COM non_tsd

I.e. if compiled with gcc, both objects are marked as tls, while Sun Studio 12
cc correctly only marks tsd as TLS.

The same bug exists in gcc 4.3, 4.2 and 4.1.


-- 
           Summary: gcc emits non-TLS data as TLS on Solaris 11/SPARC
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.11
  GCC host triplet: sparc-sun-solaris2.11
GCC target triplet: sparc-sun-solaris2.11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
  2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
@ 2008-11-14 19:10 ` ebotcazou at gcc dot gnu dot org
  2008-11-17 14:26 ` ro at techfak dot uni-bielefeld dot de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-11-14 19:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ebotcazou at gcc dot gnu dot org  2008-11-14 19:08 -------


*** This bug has been marked as a duplicate of 29987 ***


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
  2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
  2008-11-14 19:10 ` [Bug target/38118] " ebotcazou at gcc dot gnu dot org
@ 2008-11-17 14:26 ` ro at techfak dot uni-bielefeld dot de
  2008-11-18  8:25 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: ro at techfak dot uni-bielefeld dot de @ 2008-11-17 14:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ro at techfak dot uni-bielefeld dot de  2008-11-17 14:25 -------
Subject: Re:  gcc emits non-TLS data as TLS on Solaris 11/SPARC

I'm not completely sure this is a bug in Sun as.  If you consider the
assembler code for my testcase produced by gcc:

        .global tsd
        .section        ".tbss",#alloc,#write,#tls
        .align 4
        .type   tsd, #tls_object
        .size   tsd, 4
tsd:
        .skip 4
        .common non_tsd,4,4

versus what Studio 12 cc produces:

        .section        ".bss",#alloc,#write
        .common non_tsd,4,4
        .section        ".tbss",#alloc,#write,#tls
        .common tsd,4,4

you see that gcc lacks the section switching between non_tsd and tsd.

        Rainer


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
  2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
  2008-11-14 19:10 ` [Bug target/38118] " ebotcazou at gcc dot gnu dot org
  2008-11-17 14:26 ` ro at techfak dot uni-bielefeld dot de
@ 2008-11-18  8:25 ` ebotcazou at gcc dot gnu dot org
  2008-11-18  9:40 ` jakub at gcc dot gnu dot org
  2010-03-24 18:50 ` ro at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-11-18  8:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2008-11-18 08:24 -------
> I'm not completely sure this is a bug in Sun as.  If you consider the
> assembler code for my testcase produced by gcc:
> 
>         .global tsd
>         .section        ".tbss",#alloc,#write,#tls
>         .align 4
>         .type   tsd, #tls_object
>         .size   tsd, 4
> tsd:
>         .skip 4
>         .common non_tsd,4,4
> 
> versus what Studio 12 cc produces:
> 
>         .section        ".bss",#alloc,#write
>         .common non_tsd,4,4
>         .section        ".tbss",#alloc,#write,#tls
>         .common tsd,4,4
> 
> you see that gcc lacks the section switching between non_tsd and tsd.

OK, this makes sense, but I'd suggest discussing that under PR 29987.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
  2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-11-18  8:25 ` ebotcazou at gcc dot gnu dot org
@ 2008-11-18  9:40 ` jakub at gcc dot gnu dot org
  2010-03-24 18:50 ` ro at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-11-18  9:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2008-11-18 09:39 -------
If you don't want to call it a bug, call it at least a misfeature.
Given that Solaris as supports .tls_common directive, having .common directive
behave differently depending on whether current section is .tbss (apparently
comparison by name, flags don't matter and when in .tdata .common behaves
normally) or not is very surprising.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
  2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-11-18  9:40 ` jakub at gcc dot gnu dot org
@ 2010-03-24 18:50 ` ro at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: ro at gcc dot gnu dot org @ 2010-03-24 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ro at gcc dot gnu dot org  2010-03-24 18:50 -------
Subject: Bug 38118

Author: ro
Date: Wed Mar 24 18:49:49 2010
New Revision: 157705

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157705
Log:
        * configure.ac (i[34567]86-*-*): Handle Solaris 2/x86 TLS support
        and Sun as TLS syntax.
        (TLS_SECTION_ASM_FLAG) [on_solaris && !gas_flag]: Define.
        * configure: Regenerate.
        * config.in: Regenerate.
        * varasm.c (TLS_SECTION_ASM_FLAG): Define default.
        (default_elf_asm_named_section): Use it.
        * config/i386/i386.c (output_pic_addr_const): Lowercase @DTPOFF.
        (i386_output_dwarf_dtprel): Likewise.
        (output_addr_const_extra): Likewise.
        (output_pic_addr_const): Lowercase @GOTTPOFF.
        (output_addr_const_extra): Likewise.
        (output_pic_addr_const): Lowercase @GOTNTPOFF.
        (output_addr_const_extra): Likewise.
        (output_pic_addr_const): Lowercase @INDNTPOFF.
        (output_addr_const_extra): Likewise.
        (output_pic_addr_const): Lowercase @NTPOFF.
        (output_addr_const_extra): Likewise.
        (output_pic_addr_const): Lowercase @TPOFF.
        (output_addr_const_extra): Likewise.
        * config/i386/i386.md (*tls_global_dynamic_32_gnu): Lowercase
        @TLSGD.
        (*tls_global_dynamic_64): Likewise.
        (*tls_local_dynamic_base_32_gnu): Lowercase @TLSLDM.
        (*tls_local_dynamic_base_64): Lowercase @TLSLD.

        * defaults.h (TLS_COMMON_ASM_OP): Provide default.
        (ASM_OUTPUT_TLS_COMMON): Use it.
        * config/i386/sol2-gas.h (TLS_COMMON_ASM_OP): Undef.

        PR target/38118
        * config.gcc (sparc*-*-solaris2*) [$gas=yes]: Add usegas.h to
        tm_file.
        * config/sparc/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Move ...
        * config/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): ... here.
        * config/i386/sol2-10.h (ASM_OUTPUT_ALIGNED_COMMON): Redefine.
        * config/i386/sol2.h (TARGET_SUN_TLS): Redefine.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config.in
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/config/i386/sol2-10.h
    trunk/gcc/config/i386/sol2-gas.h
    trunk/gcc/config/i386/sol2.h
    trunk/gcc/config/sol2.h
    trunk/gcc/config/sparc/sol2.h
    trunk/gcc/configure
    trunk/gcc/configure.ac
    trunk/gcc/defaults.h
    trunk/gcc/varasm.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/38118] gcc emits non-TLS data as TLS on Solaris 11/SPARC
       [not found] <bug-38118-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-06 19:19 ` ro at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: ro at gcc dot gnu.org @ 2011-01-06 19:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38118

--- Comment #6 from Rainer Orth <ro at gcc dot gnu.org> 2011-01-06 19:00:14 UTC ---
Author: ro
Date: Thu Jan  6 19:00:10 2011
New Revision: 168550

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168550
Log:
    PR target/38118
    * config/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Also switch to .bss
    if coming from .tdata.
    * config/i386/sol2-10.h (ASM_OUTPUT_ALIGNED_COMMON): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/sol2-10.h
    trunk/gcc/config/sol2.h


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-06 19:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 15:54 [Bug target/38118] New: gcc emits non-TLS data as TLS on Solaris 11/SPARC ro at gcc dot gnu dot org
2008-11-14 19:10 ` [Bug target/38118] " ebotcazou at gcc dot gnu dot org
2008-11-17 14:26 ` ro at techfak dot uni-bielefeld dot de
2008-11-18  8:25 ` ebotcazou at gcc dot gnu dot org
2008-11-18  9:40 ` jakub at gcc dot gnu dot org
2010-03-24 18:50 ` ro at gcc dot gnu dot org
     [not found] <bug-38118-4@http.gcc.gnu.org/bugzilla/>
2011-01-06 19:19 ` ro at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).