Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 24 Nov 2013 17:31:49 -0500
From: Rich Felker <>
Subject: Re: Clang powerpc pthread_arch.h patch.

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


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.