As discussed in the BZ, 32bit Darwin will create a mis-aligned stack when profiling is enabled.
As noted in c#9, the 32bit x86 port was enabling A_O_A when producing unwind info, this is why darwin was functional. After Jan's patch from 2013, we stopped turning on A_O_A in that situation and broke profiling for 32bit darwin as collateral damage.
Mike's fix was pretty simple, when profiling on darwin, turn on A_O_A. Jan expressed some concerns, but I find myself in agreement with Richard & Bernd that Mike's patch is a reasonable fix.
I bootstrapped and regression tested the x86_64 darwin port with the patch. I also tried to bootstrap the x86 darwin port with -p enabled by default. Not surprisingly, it failed during stage2 configuration due to the bug in 63890. With the patch applied, stage2 configures just fine with profiling enabled and bootstrapping proceeds normally.
I'm installing this on the trunk momentarily. Jeff
commit e088bc4d87d83993a2d0fcea35c77b1b174e3a35 Author: Jeff Law <l...@redhat.com> Date: Tue Mar 29 21:56:51 2016 -0600 PR target/63890 * config/i386/i386.h (ACCUMULATE_OUTGOING_ARGS): Use when profiling and TARGET_MACHO. * tree-vrp.c (register_edge_assert_for_2): For NAME != CST1 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af1b6c2..40fddc4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-03-30 Mike Stump <m...@gcc.gnu.org> + + PR target/63890 + * config/i386/i386.h (ACCUMULATE_OUTGOING_ARGS): Use when profiling + and TARGET_MACHO. + 2016-03-30 Patrick Palka <ppa...@gcc.gnu.org> PR tree-optimization/59124 diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 8d39b5d..d0b418b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1638,7 +1638,8 @@ enum reg_class #define ACCUMULATE_OUTGOING_ARGS \ ((TARGET_ACCUMULATE_OUTGOING_ARGS && optimize_function_for_speed_p (cfun)) \ - || TARGET_STACK_PROBE || TARGET_64BIT_MS_ABI) + || TARGET_STACK_PROBE || TARGET_64BIT_MS_ABI \ + || (TARGET_MACHO && crtl->profile)) /* If defined, a C expression whose value is nonzero when we want to use PUSH instructions to pass outgoing arguments. */