This is the mail archive of the gcc@gcc.gnu.org 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: i386 stack missalignment on main


> On Mon, Jul 30, 2001 at 02:16:52PM +0200, Jan Hubicka wrote:
> > 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.
> 
> No, you can't.  First, main has 3 arguments.  Two, you've
Should not be problem.
I am checking the declaration for argument count, that is safe.
> got to return the stack to normal when leaving main, so
> no simple hack is going to cut it.
See me patch.
I actually write wrapper function that calls main and restore
stack at return.  Really hope such solution is acceptable.

It should work even for dirty hacks, such as recursive main
functions not allowed by standard anyway.

Honza


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