SPARC stack layout
Sven Panne
Sven_Panne@BetaResearch.de
Wed, 28 Nov 2001 14:47:21 +0100
[ I know that this is not the perfect place to ask, because the
question in not very Haskell-related, but I know that there are a
few good SPARC hackers on this list and the GCC lists looks a bit
crowded, so I'll try here first... :-]
While figuring out the stack layout on SPARC (System V ABI v8) using
GCC, I stumbled over a strange thing: Directly below the frame pointer
%fp GCC leaves 16 bytes space, so the whole stack frame is always
16-20 bytes (depending on alignment) larger than it needs to be,
e.g. a C/C++ function without any local variables needs 112 bytes stack,
not 92, as I expected. A quick look into the SPARC part of the GCC
sources, namely gcc-3.0.2/gcc/config/sparc/sparc.h, leads to the
conclusion that this space is for a "long double", e.g. the stack
frame for
int foo(int a, int b) {
return a+b;
}
looks like the one I expected for
int foo(int a, int b) {
long double _DONT_KNOW_WHAT_THIS_IS_;
return a+b;
}
But why does *every* C/C++ function need such a buffer? Any clues?
Perplexed,
S.
--
Sven Panne Fon: +49/89/99567000 Fax: +49/89/99567461
BetaResearch GmbH, Betastr. 1, D-85774 Unterfoehring
mailto:Sven_Panne@BetaResearch.de http://www.betaresearch.de