http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49211

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

--- Comment #4 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2011-05-30 
14:59:06 UTC ---
(In reply to comment #3)
> Perhaps I miss something, but I've no idea how that should work.

Writing a bootloader, you really should.

> Regardless of
> whether $254 is initialized previously or not (in my case, it's a bootloader,
> so there is no stdlib and no crt*, but I have to do that myself), using the
> stack-pointer to access global variables can't work, right?

The key words are "setup" and "allocated" not "initialized".

Again, I suggest you have a look at crtn.asm, in particular these lines:

% This must be the last file on the link-line, allocating global registers
% from the top.

% Register $254 is the stack-pointer.
sp GREG

So, if you leave that out, the global-register-allocation machinery in the
linker will allocate registers starting from the topmost, which is $254 ($255
being a scratch register).

Reply via email to