This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc with no stack at all?


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/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]