Andrew Haley wrote: > PRC wrote: >> I haved declared all local variables in the function static. >> But gcc still generates ARCH-depended (MIPS) code at the beginning >> of the function >> >> ---------------------------------------------- >> 80006468: 27bdffe0 addiu sp,sp,-32 >> 8000646c: afbf001c sw ra,28(sp) >> 80006470: afbe0018 sw s8,24(sp) >> ... >> ---------------------------------------------- >> >> How to inform gcc not to do these for this function? > > gcc always uses the stack. ...but only if it thinks that it is more efficient than not using the stack. The stack is always used in functions that call other functions because the return address must be preserved. With some versions of gcc (3.4 and later perhaps among others), if you have a function like this:: $ cat > bar.c int f1 (int a, int b) { return a + b; } $ mipsel-linux-gcc -c -O3 bar.c $ mipsel-linux-objdump -d bar.o bar.o: file format elf32-tradlittlemips Disassembly of section .text: 00000000 <f1>: 0: 03e00008 jr ra 4: 00851021 addu v0,a0,a1 ... But in general, Andrew is correct. GCC generates code that uses the stack. If you want to generate code that does not use the stack, you have to write it in assembly language. David Daney