This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM stack alignment on hand called functions


> ----- Original Message -----
> From: "Richard Earnshaw" <rearnsha@arm.com>
> > No, I don't think this is correct, since it will mean that the structure
> > starts at an unaligned address.  Instead the space allocated for the
> > structure on the stack should be rounded up to a word and then the
> > structure copied into that space with an aligned starting point.
> 
> But in this case, the issue isn't with passing arguments but rather with
> returning them.  Earlier in hand_function_call() (in valops.c), there is
> some code where if a structure is being returned, we enlarge the stack by
> the size of the structure.  This is what wasn't aligned.  For example, if
> you called 'fun2()', which returns a 2 byte structure, the type length was
> '2' which is how much the stack pointer is out.  This way, when we write the
> stack at the start of the called function, our sp is misaligned.  The frame
> pointer is fine so the function gets the arguments alright, it's just
> writing stack variables and return values to the stack that is buggered.
> I'm looking at this and thinking, it just gives a little padding on the
> stack to maintain alignment.
> 

Then I'm not sure I understand exactly what your problem is.  If you show 
me the actual patch, rather than just trying to describe it, then perhaps 
that will be more clear.

R.


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