gcc assembler register names

Christian Ludlam chris at recoil.org
Tue Oct 1 08:55:23 PDT 2002

On 1 Oct Nick Burrett wrote:

> Peter Naulls wrote:
> > 
> > 'as' has the -gcc flag to allow register names to be defined - a1, a2,
> > r0, r1 and all the rest.
> > 
> > The problem is that GCC doesn't actually pass the flag (and anyway uses
> > its own register names), and without these register names being defined
> > (which you need to do manully if you're writing assembler), it's simply
> > a bit useless.  It can also cause problems with inline assembler.
> > 
> > So, I suggest that 'as' always has the register name defined.  In
> > addition, if GCC wishes to stay with its __r0 format, perhaps when the
> > -gcc flag is passed, those could be defined too.  Or, (radical, I know),
> > gcc dumps the __ bit.
> There are namespace clashes to be considered if gcc drops the `__'.
> As far as I'm concerned, the -gcc option should be dropped and all code 
> associated with it removed.  It is legacy code from the GCC 2.4.5 release.

In which case it may be useful as Peter says to adopt objasm's strategy of
defining normal and APCS register names by default.

as would have to accept the source redefining register names to the same
value, to avoid breaking existing code.

Christian Ludlam
chris at recoil.org

More information about the gcc mailing list