public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* fix thinko in tree-emutls, breaking tls support on vxworks
@ 2012-07-03  9:09 Olivier Hainque
  2012-07-16 18:54 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Hainque @ 2012-07-03  9:09 UTC (permalink / raw)
  To: GCC Patches; +Cc: Olivier Hainque, Richard Henderson

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

Hello,

With the current mainline configured for powerpc-wrs-vxworks,
compiling the source below exposes a problem with tls support
(emulated) on this target:

  /* t.c  */
  __thread int y = 2;

./cc1 t.c -o -

 t.c:1:14: error: __tls__y causes a section type conflict with y
 __thread int y = 2;
              ^
 t.c:1:14: note: ‘y’ was declared here
   .section .tls_data,"a",@progbits
   .align 2
   .type y, @object
   .size y, 4
 y:
   .long 2
   .globl __tls__y
   .align 2
   .type __tls__y, @object
   .size __tls__y, 12
 __tls__y:
   .long y
   .long 0
   .long 4

The error is unexpected and we observe that both "y"
and "__tls_y" are emitted in the .tls_data section despite

    targetm.emutls.var_section = ".tls_vars";

in vxworks_override_option.

This looks like a simple thinko in tree-emutls.c, which
this patch fixes.

I checked that the VxWorks compiler behaves as expected after the
patch (no error + __tls_y emitted in .tls_vars). Also bootstrapped
and regression tested on x86_64-linux.

OK to commit ?

Thanks in advance,

With Kind Regards,

Olivier

2012-07-03  Olivier Hainque  <hainque@adacore.com>

        * tree-emutls.c (new_emutls_decl): When a var_section is requested by
        the target, attach the new decl to that, not to the template section.


[-- Attachment #2: tls.diff --]
[-- Type: application/octet-stream, Size: 775 bytes --]

*** /tmp/BV69pV_tree-emutls.c	2012-07-03 11:13:13.546593377 +0200
--- gcc/tree-emutls.c	2012-06-28 15:10:47.286383962 +0200
*************** new_emutls_decl (tree decl, tree alias_o
*** 312,319 ****
    if (!DECL_COMMON (to) && targetm.emutls.var_section)
      {
        DECL_SECTION_NAME (to)
!         = build_string (strlen (targetm.emutls.tmpl_section),
! 			targetm.emutls.tmpl_section);
      }
  
    /* If this variable is defined locally, then we need to initialize the
--- 312,319 ----
    if (!DECL_COMMON (to) && targetm.emutls.var_section)
      {
        DECL_SECTION_NAME (to)
!         = build_string (strlen (targetm.emutls.var_section),
! 			targetm.emutls.var_section);
      }
  
    /* If this variable is defined locally, then we need to initialize the

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

* Re: fix thinko in tree-emutls, breaking tls support on vxworks
  2012-07-03  9:09 fix thinko in tree-emutls, breaking tls support on vxworks Olivier Hainque
@ 2012-07-16 18:54 ` Richard Henderson
  2012-08-06 15:16   ` Olivier Hainque
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2012-07-16 18:54 UTC (permalink / raw)
  To: Olivier Hainque; +Cc: GCC Patches

On 07/03/2012 02:09 AM, Olivier Hainque wrote:
> 2012-07-03  Olivier Hainque  <hainque@adacore.com>
> 
>         * tree-emutls.c (new_emutls_decl): When a var_section is requested by
>         the target, attach the new decl to that, not to the template section.


Ok.


r~

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

* Re: fix thinko in tree-emutls, breaking tls support on vxworks
  2012-07-16 18:54 ` Richard Henderson
@ 2012-08-06 15:16   ` Olivier Hainque
  0 siblings, 0 replies; 3+ messages in thread
From: Olivier Hainque @ 2012-08-06 15:16 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Olivier Hainque, GCC Patches


On Jul 16, 2012, at 19:48 , Richard Henderson wrote:
>>        * tree-emutls.c (new_emutls_decl): When a var_section is requested by
>>        the target, attach the new decl to that, not to the template section.
> 
> Ok.

rev 190179, after a couple of weeks off.

Thanks :)

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

end of thread, other threads:[~2012-08-06 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03  9:09 fix thinko in tree-emutls, breaking tls support on vxworks Olivier Hainque
2012-07-16 18:54 ` Richard Henderson
2012-08-06 15:16   ` Olivier Hainque

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).