From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4280 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Clang powerpc pthread_arch.h patch. Date: Sun, 24 Nov 2013 17:31:49 -0500 Message-ID: <20131124223148.GC24286@brightrain.aerifal.cx> References: <52925240.7050300@pennware.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1385332319 13009 80.91.229.3 (24 Nov 2013 22:31:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Nov 2013 22:31:59 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4284-gllmg-musl=m.gmane.org@lists.openwall.com Sun Nov 24 23:32:05 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VkiDk-0005Kj-On for gllmg-musl@plane.gmane.org; Sun, 24 Nov 2013 23:32:04 +0100 Original-Received: (qmail 24419 invoked by uid 550); 24 Nov 2013 22:32:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24403 invoked from network); 24 Nov 2013 22:32:02 -0000 Content-Disposition: inline In-Reply-To: <52925240.7050300@pennware.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4280 Archived-At: 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