All of lore.kernel.org
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: Carlos O'Donell <carlos@systemhalted.org>
Cc: debian-hppa@lists.debian.org,
	linux-parisc <linux-parisc@vger.kernel.org>
Subject: Re: [PATCH] parisc: futex: Use same lock set as lws calls
Date: Fri, 21 Oct 2011 13:42:48 -0400	[thread overview]
Message-ID: <4EA1AF18.9010605@bell.net> (raw)
In-Reply-To: <CADZpyizJx5fHwv5aHqoN-u1D95ph6dw8S+cAHKRS=MR6Y0WaPQ@mail.gmail.com>

On 10/21/2011 10:49 AM, Carlos O'Donell wrote:
> On Wed, Oct 19, 2011 at 9:47 PM, John David Anglin<dave.anglin@bell.net>  wrote:
>> I looked at this a bit.  The problem is legitimize_tls_address doesn't work
>> properly. First, GCC doesn't know that the libcall needs r26 and ret0 when the
>> __thread variable is an argument to a call.  Secondly, the implementation of __tls_get_addr
>> clobbers some other call clobbered registers.  I'm thinking the glibc implementation
>> might need to be in assembly language so that the clobbered registers are limited (i.e.,
>> it needs to save registers).   This all seems really ugly...
>>
>> The issues occur in generating PIC code.
> Yes, __tls_get_addr is a normal C function and follows normal function
> register usage.
Yes.  The issue here is expand_call doesn't appear to be aware that 
loading the
address of a __thread variable may require a call.  Thus, it just emits 
an insn to
load r26.  This load is dead because r26 is reloaded for the call to 
__tls_get_addr.

The first argument for the call needs to be saved to a temp, and then 
r26 needs
to be loaded just before the actual call.  This is works fine for normal 
calls.
>
> Why does __tls_get_addr need to be a special function?
>
> Almost all the targets in glibc-ports have C versions of __tls_get_addr.
>
> For example I notice that on Alpha the call to __tls_get_addr is *not*
> done via a emit_library_call_value, instead they use some emit_insn,
> emit_libcall_block and use_reg.
use_reg won't help.  This is attached to the call insn and only comes 
into play
during register allocation.  The problem occurs during rtl expansion.
>
> So it looks like they tamper with the register usage via use_reg
> before the call to __tls_get_addr?
>
> Another example is Sparc which also uses a custom sequence and
> manipulates the used registers.
sparc64 tls support is also broken...  See,
http://www.loria.fr/~zimmerma/software/compilerbugs.html

>
> I think our legitimize_tls_address needs to be rewritten to match
> something like what alpha or sparc has, otherwise we are going to run
> into trouble trying to get emit_library_call_value to work correctly.
>
>

Dave

-- 
John David Anglin    dave.anglin@bell.net


  reply	other threads:[~2011-10-21 17:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-09 20:40 [PATCH] parisc: futex: Use same lock set as lws calls John David Anglin
2011-10-10 14:30 ` Rolf Eike Beer
2011-10-10 20:27   ` John David Anglin
2011-10-10 20:30     ` James Bottomley
2011-10-17 15:23 ` Domenico Andreoli
2011-10-17 15:47   ` Carlos O'Donell
2011-10-17 18:10     ` John David Anglin
2011-10-17 20:55       ` Carlos O'Donell
2011-10-17 21:09         ` John David Anglin
2011-10-17 21:57           ` Domenico Andreoli
2011-10-17 22:28             ` John David Anglin
2011-10-18  9:31               ` Domenico Andreoli
2011-10-18  9:33               ` Domenico Andreoli
2011-10-18 14:20                 ` John David Anglin
2011-10-18  3:01           ` Carlos O'Donell
2011-10-18  3:21             ` Carlos O'Donell
2011-10-18 21:22               ` Carlos O'Donell
2011-10-20 15:35           ` Carlos O'Donell
2011-10-20 17:57             ` Matt Turner
2011-10-20 18:11               ` Carlos O'Donell
2011-10-20 18:16                 ` Matt Turner
2011-10-20  1:47       ` John David Anglin
2011-10-21 14:49         ` Carlos O'Donell
2011-10-21 17:42           ` John David Anglin [this message]
2011-10-21 18:11             ` John David Anglin
2011-10-21 18:15               ` Carlos O'Donell
2011-10-30 15:04                 ` John David Anglin
2011-10-30 15:31                   ` Rolf Eike Beer
2011-10-30 16:13                     ` John David Anglin
2011-10-31  0:21                       ` Carlos O'Donell
2011-10-31  1:36                         ` John David Anglin
2011-10-31  9:41                           ` Domenico Andreoli
2011-10-31 12:28                             ` John David Anglin
2011-10-31 23:26                             ` John David Anglin
2011-11-01  9:15                               ` Domenico Andreoli
2011-11-01  2:15                           ` Carlos O'Donell
2011-11-01  9:19                             ` Domenico Andreoli
2011-11-01 19:56                               ` John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA1AF18.9010605@bell.net \
    --to=dave.anglin@bell.net \
    --cc=carlos@systemhalted.org \
    --cc=debian-hppa@lists.debian.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.