This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix bad interaction between -pg and stack realignment on x86
- From: Richard Henderson <rth at redhat dot com>
- To: Olivier Hainque <hainque at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Feb 2007 11:15:37 -0800
- Subject: Re: [PATCH] fix bad interaction between -pg and stack realignment on x86
- References: <20070228105308.GA16548@cardhu.act-europe.fr>
On Wed, Feb 28, 2007 at 11:53:08AM +0100, Olivier Hainque wrote:
> gcc/
>
> * config/i386/i386.h (PROFILE_COUNT_REGISTER): Turn into ...
> (PROFILE_COUNT_REGNUM): New macro.
> (MCOUNT_PRESERVES_ALL_REGS): New macro, tells whether mcount
> preserves all regs. Default to 1 here, to be redefined by subtarget
> configurations as needed.
> * config/i386/i386.c (X86_SET_PROFILE_COUNTERS): New local macro,
> always defined. Conveys whether NO_PROFILE_COUNTERS is defined.
> (x86_function_profiler): Split into ...
> (x86_64_function_profiler): New function, and
> (x86_32_function_profiler): New function. Save/restore the
> force_align_arg_pointer register when needed.
> * config/i386/sol2.h (MCOUNT_PRESERVES_ALL_REGS): Redefine to 0.
>
> testsuite/
>
> * gcc.target/i386/force_align_mcount.c: New case.
Ok.
You might also save/restore the argument regisers, if any. E.g.
/* { dg-do run { target i?86-*-* } } */
/* { dg-options "-pg" } */
extern void abort (void);
void __attribute__ ((regparm(3))) foo (int a, int b, int c)
{
if (a != 1 || b != 2 || c != 3)
abort ();
}
int main (int argc, char *argv[])
{
foo (1, 2, 3);
return 0;
}