From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Mouw To: jgarzik@mandrakesoft.com Cc: gcc@gcc.gnu.org Subject: Re: gcc with no stack at all? Date: Fri, 31 Mar 2000 06:20:00 -0000 Message-id: <200003311420.QAA21013@duteinh.et.tudelft.nl> References: <38E3FB43.A7389718@mandrakesoft.com> X-SW-Source: 2000-03/msg00849.html 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/