Richard Sandiford wrote:
> > 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)
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.
> > 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.