This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
i386 stack missalignment on main
- To: gcc at gcc dot gnu dot org, rth at cygnus dot com, aj at suse dot de
- Subject: i386 stack missalignment on main
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 30 Jul 2001 14:16:52 +0200
Hi,
the benefits of so discussed -fpreferred-stack-boudnary is dumy on most of
systems (on the other hands Andreas's spcec2000 tester has shown that the
negative benefits are minimal too), as the stack gets missaligned, as you
may check easilly:
#include <stdio.h>
main ()
{
long double a;
fprintf(stderr,"%i\n",((int)&a)&15);
}
should print 0.
I've checked SuSE, debian and cygwin and all seems to get stack at
main wrong. On Linux systems it seems to be issue of glibc being compiled
by old gcc that contains bug in keeping stack aligned and missalign it on
the way.
It seems to be unrealitic to fix the systems in 3.0 timeframe, so I would
like to develop hack that fixes the alignment. Question is whether
I can get my assembly function invoked on the way late enought to be
sure that I can't get missalignment, or I need to augument gcc to output
something like
.globl main:
main:
<align stack and move arguments>
call label
<return>
label:
normal code
and whether it is safe to expect main to have maximally two arguments then.
Ideas?
Honza