Subject: re: "detected global register use not covered by .register pseudo-op"
To: matthew green <mrg@eterna.com.au>
From: Eduardo Horvath <eeh@NetBSD.org>
List: port-sparc64
Date: 09/24/2007 15:53:55
On Mon, 24 Sep 2007, matthew green wrote:

>    I'm trying to build some code on 3.1 sparc64, and I'm getting assembler
>    errors saying "detected global register use not covered by .register
>    pseudo-op".
>    
>    Now, the code does include some assaembly.  I'm prepared to hack on it.
>    But I can't usefully do this until I know what the complaint is
>    complaining about.  I tried google, but it just showed me a bunch of
>    people describing getting the same complaint out of sparc64 for various
>    OSes and pieces of software, with no explanations of what it meant or
>    how to deal with it.  "man as" was even less help; it doesn't mention
>    the .register pseudo-op at all.  I infer that one has to use .register
>    in some way to "cover" uses of global registers, but that's not much
>    help - it's not even clear what "global registers" means (%g0-%g7?
>    registers not saved by functions? something else?).
>    
>    Any pointers or other hints?
> 
> 
> i don't remember exactly what it is about but newer code
> tends to have this in it:
> 
>        .register       %g2,#scratch
>        .register       %g3,#scratch
> 
> i had to fix netbsd src for newer gcc at some point in the
> last few years.

The SPARC V9 assembler has added checks for illegal use of global
registers to prevent violating the ABI, so if you plan to use any
%g regs you need to add a .register directive first.

Eduardo