This is the mail archive of the 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: Fix preferred_stack_boundary initialization

> Looking through the stack alignments issues I mentioned on the gcc
> list, I noticed the following bug - and it might be that this fixes
> the problem Jens had (Jens, can you check this?  The patch is against
> current gcc from CVS).
> Is this ok to commit?  Or did I misunderstood the documentation?
> I've bootstrapped and run make check on i686-linux.
> Andreas
> 2001-02-03  Andreas Jaeger  <>
>	* function.c (prepare_function_start): Correctly set
>	preferred_stack_boundary.

I think function.c is NOT the correct place to fix the reported
misaligned stack. 

I check the alignment of the arguments and lokal variables with the current 
released gcc. The current gcc is absolutely correct aligned with a modified 
startup code. You can check it with:

void xxx( double d1 ){
        double d2;
        printf( "argument: %x\nlocal:    %x\n", &d1, &d2 );
main(  ){
        xxx( 0.0 );

The startup code in glibc's start.S is also correctly aligned.
Geert Bosch explained that very well. Please note, from startup 
in start.S is NOT called user's main function!! There is some
more startup stuff implemented:

>        pushl %ecx              /* Push second argument: argv.  */
>        pushl %esi              /* Push first argument: argc.  */
>        pushl $main					// address of user's main
>        /* Call the user's main function, and exit with its value.
>           But let the libc call main.    */
>        call __libc_start_main				// more startup stuff
>        hlt                     /* Crash if somehow `exit' does return.  */

Please note, my suggestion to changed start.S works, but it is also not
the correct place to fix the problem. 

-- Jens

------------- -------------
| | | | /   Dipl.-Ing. Jens Wallner
| | | | \   Institute of Microelectronic Systems
| | | | /   Appelstr. 4, D - 30 167 Hannover, Germany


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