This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc with no stack at all?
- To: jgarzik at mandrakesoft dot com
- Subject: Re: gcc with no stack at all?
- From: Erik Mouw <J dot A dot K dot Mouw at its dot tudelft dot nl>
- Date: Fri, 31 Mar 2000 16:20:30 +0200 (MET DST)
- Cc: gcc at gcc dot gnu dot org
- Organization: Eric conspiracy secret labs
On Thu, 30 Mar 2000 20:11:31 -0500, Jeff Garzik wrote:
> For low-level BIOS type code, some portions of early chipset init must
> run without a stack.
That's tricky. AFAIK gcc always needs a stack to store function return
addresses, although it depends on the platform (ARM uses r14, for
example).
> Is it possible to write gcc-compilable C code which doesn't require a
> stack at all?
I'm afraid not, but again, it depends on the platform.
> I don't see any '-fno-stack' option in gcc.info*, but I was wondering if
> it could be done implicitly, for example '-fno-builtin' plus no local
> vars plus an all-register calling convention.
The way it is usually done is to write a small piece of assembly code that
does the basic stack setup and call a C function as soon as possible. I've
done it that way in blob, a GPL'ed boot loader for the LART (an SA-1100
based computer board, see signature for URL). IIRC, the Linux kernel does
it the same way.
Erik
--
LART. 250 MIPS under one Watt. Free hardware design files.
http://www.lart.tudelft.nl/