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]
Other format: [Raw text]

expand_main_function/PREFERRED_STACK_BOUNDARY on ppc


Hello,

As mentioned in a previous discussion at
  http://gcc.gnu.org/ml/gcc/2005-04/msg01416.html

we have troubles with the expand_main_function code to adjust the stack
pointer to PREFERRED_STACK_BOUNDARY on entry points.

It currently aligns the stack pointer by applying explicit operations on it
and then resorts to allocate_dynamic_stack_space to "pick up the pieces", as
the comment says:

  /* Forcibly align the stack.  */
  [...]
  /* Enlist allocate_dynamic_stack_space to pick up the pieces.  */

We are using that code on an eabi ppc target to ensure
PREFERRED_STACK_BOUNDARY is honored. The current code badly interacts with the
ABI because the back-chain cannot be found at the address denoted by the stack
pointer after the first step above if it actually affects the register.

A possible way to address that is to have expand_main_function compute the
distance between the current and aligned values of the stack pointer (without
touching it), and resort to allocate_dynamic_stack_space to allocate exactly
that amount.

We have thought of slighlty updating the allocate_dynamic_stack_space
interface and code for the sake of this specific interaction.

I can provide more details as well as a tentative patch, and would be glad to
hear opinions on the overall issue and approach first, so ...

Thanks in advance for your help,

Olivier








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