mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Clang powerpc pthread_arch.h patch.
Date: Sun, 24 Nov 2013 17:31:49 -0500	[thread overview]
Message-ID: <20131124223148.GC24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <52925240.7050300@pennware.com>

On Sun, Nov 24, 2013 at 01:23:44PM -0600, Richard Pennington wrote:
> I had a problem with clang and __pthread_self() on the powerpc. This
> is the patch I applied to work around it.
> 
> Index: pthread_arch.h
> ===================================================================
> --- pthread_arch.h      (revision 3604)
> +++ pthread_arch.h      (working copy)
> @@ -1,6 +1,11 @@
>  static inline struct pthread *__pthread_self()
>  {
> +#ifdef __clang__
> +        char *tp;
> +        __asm__ __volatile__ ("mr %0, 2" : "=r" (tp) : : "2" );
> +#else

Why is "2" in the clobberlist? It's just read, not written. In
principle there should be some way to indicate that the asm has hidden
state it reads so that it couldn't be reordered before the initial asm
call that initializes the register, but that would be massive
reordering that's not likely to happen anyway. I'm not sure what the
right way to encode this as a constraint is...

Rich


  reply	other threads:[~2013-11-24 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24 19:23 Richard Pennington
2013-11-24 22:31 ` Rich Felker [this message]
2013-11-24 22:46   ` Richard Pennington
2013-12-02  7:48     ` Rich Felker
2013-12-02 12:50       ` Richard Pennington

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=20131124223148.GC24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).