linux-mips
[Top] [All Lists]

Re: [PATCH] Improve atomic.h implementation robustness

To: Richard Sandiford <rsandifo@redhat.com>
Subject: Re: [PATCH] Improve atomic.h implementation robustness
From: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Date: Tue, 7 Dec 2004 13:56:59 +0100
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>, Dominic Sweetman <dom@mips.com>, linux-mips@linux-mips.org, Nigel Stephens <nigel@mips.com>, David Ung <davidu@mips.com>
In-reply-to: <wvn653epbi1.fsf@talisman.cambridge.redhat.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20041201070014.GG3225@rembrandt.csv.ica.uni-stuttgart.de> <16813.39660.948092.328493@doms-laptop.algor.co.uk> <20041201123336.GA5612@linux-mips.org> <Pine.LNX.4.58L.0412012136480.13579@blysk.ds.pg.gda.pl> <wvn653epbi1.fsf@talisman.cambridge.redhat.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.6i
Richard Sandiford wrote:
[snip]
> >  Only for old compilers.  For current (>= 3.4) ones you can use the "R"  
> > constraint and get exactly what you need.
> 
> Right.  IMO, this is exactly the right fix.  It should be backward
> compatible with old toolchains too.
> 
> FYI, the 'R' constraint has been kept around specifically for inline asms.
> gcc itself no longer uses it.

I tried to use "R" in atomic.h but this failed in some (but not all)
cases with

include/asm/atomic.h:64: error: inconsistent operand constraints in an asm'

where the argument happens to be a member of a global struct.
Simple testcases work, however, as well as PIC code.

[snip]
> > I discussed this with Richard Sandiford a while ago, and the conclusion
> > was to implement an explicit --msym32 option for both gcc and gas to
> > improve register scheduling and get rid of the gas hack. So far, nobody
> > came around to actually do the work for it.
> 
> True.  FWIW, it's trivial to add this option to gcc.  As far as I remember,
> the stumbling block was whether we should mark the objects in some way,
> and whether the linker ought to check for overflow.

Both might be nice but isn't exactly reqired. The use of --msym32 will
be limited to ELF64 non-PIC code, which is only used in kernels or
other stand-alone programs with limited exposure to other binaries with
incompatible code models.


Thiemo

<Prev in Thread] Current Thread [Next in Thread>